[Israel.pm] Asychronous IO

Peter Gordon peter at pg-consultants.com
Fri Dec 4 05:08:18 PST 2009


Case:

You want to write a program that access a number of web sites
simultaneously. 

Let's suppose that there are 1000 sites to be accessed and depending on
the site, different actions need to be taken. 

Writing a program for each type of site and forking them is the obvious
and probably easiest solution. If there are more than a few sites,
forking becomes very expensive and slow. 

One solution is to only have a single thread, open all the sockets in
that thread and then process them, each according to it's own logic.

==============================================================
And now for the problem you asked on perlmonks. Reading between the
lines, I assume that Padre needs to run a debugging perl session in the
background and interact with it. If that is the case, there you could do
this:

Open a server socket in Padre and wait for socket events.
Run perl in debug mode with RemotePort defined as an option. If you look
at perl5db.pl you will find a description and the implementation. 
Now you should be able to interact with it.

Regards,

Peter





On Fri, 2009-12-04 at 11:16 +0200, Gabor Szabo wrote:
> On Fri, Dec 4, 2009 at 11:00 AM, Peter Gordon <peter at pg-consultants.com> wrote:
> > Would there be interest in a lecture on Asynchronous IO with Perl?
> > It would include an introduction to non-blocking sockets and IO::Lambda.
> 
> Could you give us use-cases? Who needs this and when?
> 
> BTW will that be able to provide a solution for this?
> http://perlmonks.org/?node_id=810674
> 
> Gabor
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl




More information about the Perl mailing list