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

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.