in reply to Multiple FTP upload threads with Net::FTP

Try something like this:

#! perl -slw use strict; use threads; use Thread::Queue; use Net::FTP; my $THREADS = 10; my $Q = new Threads::Queue; my @threads = map async { my $ftp = Net::FTP->new("host.com"); $ftp->login('blah','blah'); $ftp->ascii(); while( defined( $_ = $Q->dequeue ) ) { $ftp->put( $_ ); } $ftp->quit(); }, 1 .. $THREADS; my @files = getFiles(); $Q->enqueue( @files ); $Q->engueue( (undef) x $THREADS ); $_->join for @threads;

Start with small values (eg.10) for $THREADS and see how things go. Adjust higher slowly.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."