Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Lazy URL question?

by pileofrogs (Priest)
on May 13, 2011 at 18:11 UTC ( #904706=perlquestion: print w/ replies, xml ) Need Help??
pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks!

I didn't find the answer in 0.2 seconds using the super search, so I'm just asking... is this good or bad lazy? Anyway...

What's the best module if I want my perl script to be able to grab a file when given a URL? I'm hoping for something that will handle all the URL complexity and protocol stuff? I'm thinking one of the many curl libs, but I'm not sure which or if there is something other than curl that might be better? In case I'm not making sense (a common problem) here's what I want to be able to handle:

frobozinate.pl http://example.com/wharg.txt frobozinate.pl ftp://bob:secret@example.com/wharg.txt frobozinate.pl file:///home/bob/wharg.txt

Thanks!
--Pileofrogs

Comment on Lazy URL question?
Download Code
Re: Lazy URL question?
by JavaFan (Canon) on May 13, 2011 at 18:16 UTC
    You talk about "better" and "best". Your better isn't my better, and neither is that the better of someone else.

    Unless you give any indication of what measurement you're ranking the modules, your question should be a poll, because all you're getting as answers is peoples favourite tool.

      I guess I'm looking for something popular, as in stable, reliable & usable. I do not care about performance.

Re: Lazy URL question?
by Anonymous Monk on May 13, 2011 at 18:18 UTC

      Holy crap... LWP really does most of what I want... I can just used a different URL in my existing code! Wow!

Re: Lazy URL question?
by BrowserUk (Pope) on May 13, 2011 at 19:19 UTC

    Personally, when I've had occasion to fetch anything bigger than a few 10s of Kbytes on a regular basis, if prefer to shell out to wget.

    It handles most protocols. It gives reliability with its ability to retry many times and pick up from where it left off when things go wrong. I can throttle the transfer if it is likely to impinge upon my other network activities. And has a myriad of other features if I need them.

    As a bonus, it generally runs more quickly than my browser, LWP or any other tools I've tried.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-08-22 21:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (167 votes), past polls