Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: wget - getting status code?

by Krambambuli (Deacon)
on May 21, 2009 at 16:51 UTC ( #765502=note: print w/ replies, xml ) Need Help??


in reply to Re^2: wget - getting status code?
in thread wget - getting status code?

Just for accuracy - I think your solution is not the real answer to the question you've asked initially.

Probably irrelevant here, but you said you'd want to check if the image exists _before_ downloading it. In your code, you download it and _then_ check if it exists.

If downloading is the single option, you're code is OK. But if you'd want to avoid say images bigger then 2 GiB, you're code would waste bandwide, downloading the images and then disposing them.

To actually just check for the existence of an image, you'll want to use $ua->head($image) instead of $ua->get($image).

Just in case that could matter.


Krambambuli
---


Comment on Re^3: wget - getting status code?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://765502]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (14)
As of 2014-09-23 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (221 votes), past polls