perlmad has asked for the wisdom of the Perl Monks concerning the following question:

Hi Folks

I am using www::mechanize module to download a file from website and i could not find how long it's take to complete so i need a progress amount for downloading status, my code is shown below

$mech->save_content($filename,":content_cb" => \&callback); sub callback { my( $data, $response, $proto ) = @_; $progress_amount+= length($data); my $size = $response->header('Content-Length'); print floor(($progress_amount/$size)*100),"% downloaded\n"; # +print percent downloaded }

It is not working

Any Idea...

Replies are listed 'Best First'.
Re: Progress count for save_content in WWW::Mechanize
by afoken (Chancellor) on May 23, 2016 at 17:50 UTC
    It is not working

    ... and so are you. What do you expect to happen, what happens instead?

    Maybe you are Suffering from Buffering?

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: Progress count for save_content in WWW::Mechanize ( $ua->show_progress(1) )
by beech (Parson) on May 24, 2016 at 02:33 UTC