Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Getting the timestamp of a file

by rir (Vicar)
on Jul 30, 2008 at 21:08 UTC ( [id://701275]=note: print w/replies, xml ) Need Help??


in reply to Getting the timestamp of a file

If you just want to process the file periodically when it has changed, you can:
my $old_time = (stat( $file ))[9]; while ( 1 ) { sleep $period_in_seconds; my $current_time = (stat($file))[9]; while ( $current_time != $old_time ) { $old_time = $current_time; print "file changed$/"; $current_time = (stat($file))[9]; } }
The above nods at the issue of race conditions; it ignores possible contention issues.

Be well,
rir

Log In?
Username:
Password:

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

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

    No recent polls found