Um, what?
Here is some "mechanize"
$ lwp-request -uUsSed http://perlmonks.org/images/vroom_sm.gif GET http://perlmonks.org/images/vroom_sm.gif User-Agent: lwp-request/6.03 libwww-perl/6.08 200 OK Connection: close Date: Tue, 17 Feb 2015 00:32:01 GMT Accept-Ranges: bytes ETag: "a0f-39863fd7ace00" Server: Apache/2.2.29 Content-Length: 2575 Content-Type: image/gif Last-Modified: Fri, 25 Jan 2002 17:35:52 GMT Client-Date: Tue, 17 Feb 2015 00:33:52 GMT Client-Peer: 66.39.54.27:80 Client-Response-Num: 1 $ perl -MLWP::Simple=$ua -e " print $ua->get( q{http://perlmonks.org/i +mages/vroom_sm.gif})->header(q{Content-Length}) " 2575
so it all pretty much "just works"
#!/usr/bin/perl -- use strict; use warnings; use WWW::Mechanize 1.73; my $vroom = q{http://perlmonks.org/images/vroom_sm.gif}; my $file = 'goner-vroom_sm.gif'; my $ua = WWW::Mechanize->new( qw/ autocheck 1 show_progress 1/ ) ; $ua->get( $vroom, ':content_file' => $file ); print "$file ", -s $file, "\n"; print "$file ", $ua->res->header('content-length'), "\n"; $ua->dump_headers; __END__ ** GET http://perlmonks.org/images/vroom_sm.gif ==> 200 OK goner-vroom_sm.gif 2575 goner-vroom_sm.gif 2575 Connection: close Date: Tue, 17 Feb 2015 00:38:00 GMT Accept-Ranges: bytes ETag: "a0f-453336d2dd3c0" Server: Apache/2.2.29 Content-Length: 2575 Content-Type: image/gif Last-Modified: Wed, 30 Jul 2008 01:10:47 GMT Client-Date: Tue, 17 Feb 2015 00:39:50 GMT Client-Peer: 216.92.34.251:80 Client-Response-Num: 1
So what was the question?
In reply to Re: How to reliably get file size after calling WWW::Mechanize->get(file)?
by Anonymous Monk
in thread How to reliably get file size after calling WWW::Mechanize->get(file)?
by CoVAX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |