My question touches closely on this recent thread. I am curious if anyone has been able to do FTP uploads (PUTs) of very large files using LWP without consuming a lot of memory. I tried out something like this code while watching a system monitor (top/gtop/etc) and it ate up lots of memory:

use LWP::UserAgent; my $url = 'ftp://anonymous:anon@ftp.someserver.com/pub/100mb.file'; my $ua = LWP::UserAgent->new(); $ua->agent("$0/.01 ".$ua->agent); open (READER, "100mb.file") or die "Can't read: $!\n"; my $req = HTTP::Request->new('PUT', "$url", undef, <READER>); my $result = $ua->request($req);

Having never really needed to FTP large files, I never realized how much memory this could eat up. Now I'm worried that some old scripts we have laying around need a bit of reworking in case anyone every tries them with big files. For the sake of some other folks around who aren't familiar with Net::FTP, I'd like to continue to do this using LWP if I can. Anyone know how to reduce the amount of memory needed for something like this?

In reply to Reducing LWP Buffering by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.