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.
In reply to Re: ftp to sftp migration in perl
by atcroft
in thread ftp to sftp migration in perl
by maddyfloss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |