Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Weather RSS image

by pg (Canon)
on Nov 09, 2005 at 22:07 UTC ( #507229=note: print w/replies, xml ) Need Help??


in reply to Re^2: Weather RSS image
in thread Weather RSS image

Unfortunately your Perl code does not work. I called binmode() in my code for a reason. Your code would be fine with html files, but with images, it does not work.

If you test your code, you will see that some images are broken (or cannot be recognized as the right format).

Replies are listed 'Best First'.
Re^4: Weather RSS image
by ikegami (Pope) on Nov 09, 2005 at 22:14 UTC

    Huh? getstore calls binmode:

    elsif (!ref($arg)) { # filename open(OUT, ">$arg") or return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERV +ER_ERROR, "Cannot write to '$arg': $!"); binmode(OUT);

    source

    Call stack:

    • LWP::Protocol::collect
    • LWP::Protocol::http::request
    • LWP::UserAgent::send_request
    • LWP::UserAgent::simple_request
    • LWP::UserAgent::request
    • LWP::Simple::getstore

    It's not a recent addition either. The version of libwww-perl packaged with ActiveState Perl v5.6.1 does the same thing.

    I've successfully downloaded all the images on a Windows system (where binmode would matter) using getstore and ActiveState Perl v5.6.1.

Re^4: Weather RSS image
by davidrw (Prior) on Nov 09, 2005 at 22:54 UTC
    It does work (well, i had to do s/Sumple/Simple/ first ;) ) -- and running file weather* afterward shows "GIF image data, version 89a, 52 x 52" for all of them ...
    which images did you see as broken? Did you try re-downloading them?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://507229]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2016-12-10 09:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (160 votes). Check out past polls.