in reply to Accessing File::Monitor attribute
I think you need something more like the below:
use File::Monitor; use File::Monitor::Object; my $wFileMonitor = File::Monitor->new(); $wFileMonitor->watch($wFile); #-- First scan does nothing $wFileMonitor->scan; #-- Let's sleep so changes can happen sleep 10 #-- Subsequent calls will report changes my @changes = $wFileMonitor->scan; foreach my $object (@changes) { my $modified = $object->mtime; }
Since you're only monitoring one file I guess you'll get either 0 or 1 objects back from scan depending on whether the file changed or not.
Objects are of class File::Monitor::Delta as shown in the docs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accessing File::Monitor attribute
by herda05 (Acolyte) on Aug 11, 2009 at 21:13 UTC | |
by Crackers2 (Parson) on Aug 11, 2009 at 21:28 UTC |