[Pdx-pm] Accessing File::Monitor attribute

Daniel Herrington herda05 at gmail.com
Tue Aug 11 13:51:32 PDT 2009


I'm new to classes in perl and I've hit a roadblock using the 
File::Monitor class. From the doc for  File::Monitor 
The state of the monitored file or directory at the time of the last 
scan can be queried. Before scan is called these methods will all return 
undef. The following methods return the value of the corresponding field 
from "stat" in perlfunc.
For example:

my $modified = $object->mtime;

Now I've instantiated my object as per the instructions:

use File::Monitor; use File::Monitor::Object; my $wFileMonitor = 
File::Monitor->new(); $wFileMonitor->watch($wFile); $wFileMonitor->scan; 
my $modified = $wFileMonitor->mtime

But I get the following error:
Can't locate object method "mtime" via package "File::Monitor" at 
/home/workspace/watchFile.pl line 65.

I know it's getting lost in the reference to mtime, but I'm at a loss on 
how to access it. The doc simply refers to $object->mtime and my read of 
it says that $wFileMonitor should be $object.

Daniel B. Herrington
Director of Field Services
Robert Mark Technologies
dherrington at robertmarktechnologies.com
o: 651-769-2574
m: 503-358-8575

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/pdx-pm-list/attachments/20090811/fc0a531e/attachment.html>

More information about the Pdx-pm-list mailing list