Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Last mod not working

by ysth (Canon)
on Jan 28, 2004 at 19:01 UTC ( [id://324741]=note: print w/replies, xml ) Need Help??


in reply to Last mod not working

With this line:
my ($lastMod) = (head($url))[2];
you lose any distinction between head() failing (which returns an empty list) and head succeeding but modtime not being available. If you need to differentiate between the two, you can do it (without introducing any temp variables) by saying:
if (my (undef,undef,$lastMod) = head($url)) { # success if (!defined $lastMod) { # but alas no mod time } }
or even
my $gotHead = (my (undef,undef,$lastMod) = head($url));
This are instances of a list assignment in scalar context, which yields the number of entries in the list on the right hand side of the assignment (5 if head succeeded, 0 if it failed).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-18 21:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found