Thanks for the advice, I moved the timestap to the logit() subroutine and put in the test if the file exists. The code is still giving the same error.
When I run the command manually the program gives the following error:
Died at c:\FTP_Scripts\xml-ast-convert\xml-ast-convert.pl line 276.
Liner 276 is the die statement after the ftp->put() call.
The file exist test is successfull and the log file shows the correct file name and path, am I using the ftp->put() command incorrectly
#test if ast file exists
-e $astfile or die "Error: '$astfile' does not exist";
#open FTP session with remote server
$ftp=Net::FTP->new($elutionsFTP,
Timeout=>20,
Debug=>0,
Passive=>1) or $err=1;
if($err){
logit("$error_time_stamp >Unable to connect to remote FTP serv
+er $elutionsFTP\n$!");
die;
}
#login to to remote FTP server
$ftp->login("$elutionsID", "$elutionsPWD") or $err=1;
if($err){
logit("$error_time_stamp > Unable to login to remote FTP server $e
+lutionsFTP as $elutionsID\n$!");
die;
}
#change directory on FTP server
$ftp->cwd($putdir) or $err=1;
if ($err) {
logit("$error_time_stamp > Unable to change directory $putdir on $
+elutionsFTP server\n$!");
die;
}
$ftp->binary(); # set binary mode
$ftp->put($astfile) or $err=1;
if ($err) {
logit("$error_time_stamp > Error transferring $astfile\n$!");
die ;
}
# Log successfull upload
logit("\n\n$error_time_stamp > Transfer successfull: FTPserver: $eluti
+onsFTP\n File: $astfile\n$!");
# End session
$ftp->quit();
exit 0;
Log file output
Input XML file: c:\FTP_Scripts\xml-ast-convert\FTP_111100409D45C8DD_1201101600_0.xml
Output directory: c:\FTP_Scripts\xml-ast-convert
Successfully opened file: c:\FTP_Scripts\xml-ast-convert\FTP_111100409D45C8DD_1201101600_0.xml
Successfully created file: c:\FTP_Scripts\xml-ast-convert\NYPH-20101101-210000.ast
Error transferring c:\FTP_Scripts\xml-ast-convert\NYPH-20101101-210000.ast
Bad file descriptor
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.