<?xml version="1.0" encoding="windows-1252"?>
<node id="316845" title="Re: Getting more out of LWP::Simple" created="2003-12-24 09:14:38" updated="2005-07-07 14:42:31">
<type id="11">
note</type>
<author id="261960">
kutsu</author>
<data>
<field name="doctext">
&lt;p&gt;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.&lt;/p&gt;
&lt;code&gt;
#!/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";
}
&lt;/code&gt;
&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; 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&lt;/p&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-261960"&gt;
&lt;p&gt;&lt;i&gt;"Pain is weakness leaving the body, I find myself in pain everyday" -me&lt;/i&gt;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
168684</field>
<field name="parent_node">
168684</field>
</data>
</node>
