http://www.perlmonks.org?node_id=1024768

blue_cowdawg has asked for the wisdom of the Perl Monks concerning the following question:

Check out this sniglet of code:

foreach my $host (@hosts) { my $scpe = Net::SCP::Expect->new( host => $host, # user => $user, # password => $password, compress => 1, auto_yes => 1, no_check => 1, debug=>1, timeout => 120 ); $scpe->login($user,$password); printf "Copying files to %s:\n", $host; foreach my $file (@files) { printf "\t%s....", $file; my $remote=sprintf("%s\@%s:/tmp",$user,$host); printf "%s..",$remote; $scpe->scp( $file, $remote); printf "\r"; } }
I realize that debug is a bogus parameter but the code is failing with a timeout at the scp line after about 10 seconds. (or less)

Is there a way around this issue? Should I abandon Net::SCP::Expect? Any thoughts?


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Replies are listed 'Best First'.
Re: Net::SCP::Expect appears to ignore Timeout value
by kschwab (Vicar) on Mar 21, 2013 at 15:32 UTC
    Try setting timeout_auto and timeout_err as well. Both are used within the $scpe->scp method.

      symptoms unchanged.


      Peter L. Berghold -- Unix Professional
      Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
        Your code worked fine on my system. What's the error when it bails? Maybe you could try Net::OpenSSH and it's scp_put method?