Hi monks,
I need help on this. I have read the documentation of Net::FTP, it says for put()
" NOTE: If for some reason the transfer does not complete and an error is returned then the contents that had been transferred will not be remove automatically. "
What is the error returned? And how can I check it in the code?
I currently call put() in a loop with retries, here is a part of the code:
my $ftp_obj = get_ftp_obj();
my $put_try = 0;
my $cflag = 0;
my $MAX_RETRIES = 5;
while ($put_try < $MAX_RETRIES) {
my $ret;
$ret = $ftp_obj->put("$file_name") if ($put_try == 0);
$ret = $ftp_obj->append("$file_name") if ($put_try > 0);
last if (!$ret); # is this correct????
$put_try++;
print "Retrying to append $file_name, $put_try\n";
if ($put_try == $MAX_RETRIES) {
die "Not able to copy $file_name\n";
}
}
Am i checking the return value of the put()/append() properly?
Thanks in advance
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.