nanocv nanocv - 1 year ago 132
Perl Question

Display LWP::UserAgent download progress

I'm downloading a large file directly to a file with Perl using LWP::UserAgent and the


This is a simplified example of my code:

require LWP::UserAgent;

my $ua = LWP::UserAgent->new;

my $response = $ua->get(
:content_file => 'path/to/file/largefile.xml'

if ($response->is_success) {
print "File downloaded\n";
else {
die $response->status_line;

Is there any way to display the percentage of the download status? (or something similiar to

10% [===> ] 65.120.154 527K/s

Answer Source

From the documentation for the module.


$ua->show_progress( $boolean )

Get/set a value indicating whether a progress bar should be displayed on the terminal as requests are processed. The default is FALSE.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download