On Sun, 3 May 2009 03:19:00 -0400 Rocco Caputo <rcap...@pobox.com> wrote:
> On May 3, 2009, at 02:17, Roy M. wrote: > > > > On Sun, May 3, 2009 at 2:02 PM, Rocco Caputo <rcap...@pobox.com> > > wrote: > >> I don't understand the question. Do you mean to imply that an > >> event-driven > >> program cannot consume data from multiple producers? > > > > I think at least if you want to access blocking method in the main > > event loop, then thread is needed. > > True concurrency is only needed if an operation blocks too long for > the application. > > > e.g. in python twisted, they have threadpool > > http://twistedmatrix.com/projects/core/documentation/howto/threading.html > > > > Just wonder if have the same thing in POE. > > > Yes, Perl is Turing complete. You can write programs with it that > use POE and true concurrency at the same time. > > Be aware that threads aren't the only form of concurrency at your > disposal. > Maybe it is just me, but doing a for(0..$x) { [instantiate FTP component here] } would solve this non-problem. Or am I missing something? And I back Rocco here. You have not demonstrated that your blocking call to the database would be significant enough to require further engineering. Even if you made a connection to the database, authenticated, prepared a statement, and executed that statement for every file that you downloaded, you would /still/ not introduce enough of a block. Largely because if you are in POE, each one of those steps would be an individual event that would be interleaved and executed along with everything else that is going on. See any of the POE::Component::*DBI* modules that demonstrate non-blocking database calls (ie. all of them). -- Nicholas Perez XMPP/Email: n...@nickandperla.net http://search.cpan.org/~nperez/ http://github.com/nperez