Home > Archive > PERL POE > January 2006 > Using POE in an already existing perl script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using POE in an already existing perl script
|
|
| Thilo 2006-01-10, 12:24 am |
| Hi all,
We are using a perl based network service in our IRC
network which basically does the following:
- Returns nick, ident and host for every new connection
- Allows to load modules for processing the returned information
This basic service ist not POE based.
We have now developed a simply module which is loaded in
the context of this script:
- It resolves the returned host to an IP address
- The IP address is checked against our own mysql based proxy database
- The IP address is checked against some DNSBLs
- Upon a proxy match the IP address is returned
to network service script which glines this IP
To speed up this process I'm thinking about converting this module to POE.
I have bin thinking about a POE::Queue to collect all the
hosts returned by network service script and to convert
this check module to a POE::Wheel::Run to process
the IPs from the queue.
I'm very excited about this POE idea but as I'm pretty
new to perl and even more so on POE I have a few questions:
- Does this sort of approach make sense?
- Would a session in the module block the rest of the service script?
- Would the script continue to return IPs to the POE::Queue
while the wheel is processing them?
Thanks for any insight to this matter,
Thilo
| |
| Dieter Muecke 2006-01-10, 12:24 am |
|
On 23.12.2005, at 15:03, Thilo wrote:
> Hi all,
>
> We are using a perl based network service in our IRC
> network which basically does the following:
> - Returns nick, ident and host for every new connection
> - Allows to load modules for processing the returned information
> This basic service ist not POE based.
>
> We have now developed a simply module which is loaded in
> the context of this script:
> - It resolves the returned host to an IP address
> - The IP address is checked against our own mysql based proxy database
> - The IP address is checked against some DNSBLs
> - Upon a proxy match the IP address is returned
> to network service script which glines this IP
>
> To speed up this process I'm thinking about converting this module
> to POE.
> I have bin thinking about a POE::Queue to collect all the
> hosts returned by network service script and to convert
> this check module to a POE::Wheel::Run to process
> the IPs from the queue.
>
I'm writing code to run some jabber bots and must say POE makes code
better maintainable, async I/O realises multiple "sessions" in
parallel without hassle and existing POE components allow you to
focus on your job. POE learning curve is a little bit higher but
you're new in Perl and hopefully not spoilt by mediocre CGI stuff.
> I'm very excited about this POE idea but as I'm pretty
> new to perl and even more so on POE I have a few questions:
> - Does this sort of approach make sense?
Don't know if POE::Queue is needed, I'm using POE in all my
applications run jobs as mentioned above and had never used POE::Queue.
> - Would a session in the module block the rest of the service script?
POE is perfect solution if you're performing I/O stuff. So DNS look-
ups, long async db queries are exactly that kind of tasks you can do
in parallel without forking or threading.
> - Would the script continue to return IPs to the POE::Queue
> while the wheel is processing them?
yes
Kind regards,
Dieter Muecke
,,,^..^,,,
> Thanks for any insight to this matter,
>
> Thilo
>
|
|
|
|
|