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

Hi, I am trying to add sftp module in my perl script. I have used "use Net::SFTP;". Now when I run the script, I get the below two errors. 1) Application error at /usr/packages/perl/perl-5.8.8/lib/site_perl/5.8.8/Net/SSH/Perl/Kex.pm line 146 2) Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Oracle::db handle <DB_name> at /usr/packages/perl/perl-5.8.8/lib/site_perl/5.8.8/Try/Tiny.pm line 67. Not sure if I need to add/modify any library file. Please help. Thanks

Replies are listed 'Best First'.
Re: ftp to sftp migration in perl
by choroba (Cardinal) on Apr 21, 2016 at 14:31 UTC
    The errors don't seem to be connected to Net::SFTP. Can you show the relevant code?

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re: ftp to sftp migration in perl
by atcroft (Abbot) on Apr 21, 2016 at 19:48 UTC

    I would suggest adding the following (at the top of your script) for debugging:

    use strict; use warnings; use Carp; # other use statements here... $SIG{__DIE__} = sub { Carp::confess @_ }; # remainder of your code here...

    I would then run the code. The Carp::confess will (effectively) give you a full stack trace of calls when the die() occurred. You can then see where your script was when the error occurred.

    My hunch is that when your Net::SFTP connection failed and the program exited (error 1), error 2 was generated because the database handle was destroyed (forcing the rollback) with no disconnect.

    You may want to consider opening the database connection after you have the SSH/SFTP connection completed, using a signal handler to clean up the database handle if an error occurs, or change the way the database connection is created (although I doubt that one is what you want).

    Hope that helps.

Re: ftp to sftp migration in perl
by salva (Canon) on Apr 22, 2016 at 08:01 UTC