Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Getting more out of LWP::Simple

by kutsu (Priest)
on Dec 24, 2003 at 14:14 UTC ( #316845=note: print w/ replies, xml ) Need Help??


in reply to Getting more out of LWP::Simple

Excellent Tutorial, Dog and Pony. I have seen a number of posts on checking a remote file, so I offer this solution using LWP::Simple, hoping this is the best place to put it.

#!/usr/bin/perl -w use strict; use LWP::Simple; my $url = 'http://www.somesite.com/somefile'; head($url) ? print "Good\n" : print "No file\n"; #or if you don't like/know about ?: if (head($url)) { print "Good\n"; } else { print "No File\n"; }

Update: yes I know this is in the head function in the tutorial, I just want to stress that it can be done to anyfile not just a webpage

"Pain is weakness leaving the body, I find myself in pain everyday" -me


Comment on Re: Getting more out of LWP::Simple
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2015-07-04 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls