You could do this which eliminates the need for executing separate append operations for each read:
- Open an ftp connection to the remote server
- Initiate an append operation and open the data connection to the ftp server.
- Start your read loop and write what you read to the data connection. Also perform whatver tracking of the data here.
- When done reading, close the data connection. (Crossing your fingers before closing the connection would be advisable here.)
Basically you would be customizing the
_store_cmd() routine in
Net::FTP with your own process. Sub-classing
Net::FTP actually might not be a half-bad way to do this.
Update: Adding a call-back to Net::FTP for progress tracking shouldn't be too hard. It already prints out hash marks using this code in _store_cmd():
if ($hashh) {
$count += $len;
print $hashh "#" x (int($count / $hashb));
$count %= $hashb;
}
Just replace that with your own code.
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.