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

OK.. so I'm using Net::SCP::Expect to automate some of my work. Check this bit of code:

my $scpe= new Net::SCP::Expect ( host => 'myhost', user => 'myaccount', password => 'secret', recursive => 1, preserve => 1, compress => 1, no_check => 1, timeout => 60, ); $scpe -> scp ("/home/path/whatever", "myaccount@myhost:/tmp/" );

I've put as much of the code as I dare but that is the essence and I bomb out with

scp timed out while trying to connect to myhost at script  line 122

I add a single line in the "new" call:

verbose => 1
and the darn thing works. I hate to think I have to deal with the ugly output verbose mode gives, but it does make the script work.

Thoughts anybody?


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 wierdness
by salva (Canon) on Aug 29, 2012 at 20:56 UTC
    Maybe the internal timer used by Net::SCP::Expect is reset every time something arrives through the tty. Have you tried increasing the timeout value?

    Alternatively, try using Net::SSH2 or transferring the file via SFTP with Net::SFTP::Foreign.

          Maybe the internal timer used by Net::SCP::Expect is reset every time something arrives through the tty. Have you tried increasing the timeout value?

      Yes I did to ridiculous values. 900 seconds? really? Still didn't work for me.

      <ul
        transferring the file via SFTP with Net::SFTP::Foreign.

    Tried that too and it did not work for all the hosts I have to do transfers to.

    This problem is driving me nuts... and I'm already close enough to walk.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
        Are you able to transfer the files using scp from the command line with the -q flag set?

        Have you tried upgrading your client machine to the latest version of OpenSSH?

        What are exactly the kind of problems you see when using SFTP? Is it disabled in some host?