Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: ftp to sftp migration in perl

by atcroft (Abbot)
on Apr 21, 2016 at 19:48 UTC ( [id://1161150]=note: print w/replies, xml ) Need Help??


in reply to ftp to sftp migration in perl

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1161150]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-20 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found