http://www.perlmonks.org?node_id=940782


in reply to Re^2: POST'ing a large File with LWP::UserAgent
in thread POST'ing a large File with LWP::UserAgent

Thanks for the feed back. Hi can you explain what the below code actually do

# set up callback { my $gen = $req->content(); die unless ref($gen) eq "CODE"; my $i = 0; $req->content( sub { my $chunk = &$gen(); # get chunk of data warn $i++; return $chunk; # send it to $url } );

Replies are listed 'Best First'.
Re^4: POST'ing a large File with LWP::UserAgent
by Anonymous Monk on Nov 30, 2011 at 08:32 UTC

    Thanks for the feed back. Hi can you explain what the below code actually do

    Hi. There is no way you were overrider ;)

    The code saves the default (DYNAMIC_FILE_UPLOAD) callback for uploading a large file, and wraps it in another callback, which invokes the original callback, but also counts the number of times it was called, and reports the number stderr