This queue is for tickets about the File-Monitor CPAN distribution.

Report information
The Basics
Id:
63122
Status:
open
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
chinayrh [...] gmail.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Files monitor
Date: Thu, 18 Nov 2010 12:55:59 -0600
To: bug-file-monitor@rt.cpan.org
From: "Xiaobo(BOB) Qin" <chinayrh@gmail.com>
Hi; 
 
I use the delta package to monitor a directory and want to find the file modified and then copy it to a new path immediately and automatically in background when i am composing these files simutaneously. I tried the following codes which were copied from http://search.cpan.org/~andya/File-Monitor-0.10/lib/File/Monitor/Delta.pm.
 
I tried to run the codes, but always got a wrong message "Can't call method "scan" on an undefined value at C:\Hunan\PHD\PHDPAPER\delta.pl line 13."
 
use File::Monitor;
my $monitor = File::Monitor->new();
use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);
    # Watch some files
    for my $file (qw( c:\\Hunan\\PHD\\PHDPAPER )) {
        $monitor->watch( $file );
        }
    # First scan just finds out about the monitored files. No changes
    # will be reported.
    $object->scan;
      
    # After the first scan we get a list of File::Monitor::Delta objects
    # that describe any changes
    my @changes = $object->scan;
    for my $change (@changes) {
        # Call methods on File::Monitor::Delta to discover what changed
        if ($change->is_mtime) {
            my $name     = $change->name;
            my $old_mtime = $change->old_mtime;
            my $new_mtime = $change->new_mtime;
            print "$name has changed size from $old_mtime to $new_mtime\n";
            fcopy ("$name", "p://newpath");
        }
    }
    
Would you pleas to help me figure it out, this will be great help to my paper writing.
 
Thanks a lot for your time!
 
Withe best regards!
 

Xiaobo Qin
Semiaried priarie agricultural research centre
Agriculture and Agri-Food Canada
Telephone: 306-778-7285 Facsimile: 306-778-7220
Office Address:Swift Current, SK, Canada S9H 3X2

Institute of Environment and Sustainable Development in Agriculture
Chiese Academy Of Agricultural Sciences (IEDA, CAAS)
Beijing China

xiaobo.qin@agr.gc.ca
chinayrh@gmail.com


From: spam-bitcard@yary.ack.org
You should call $monitor->scan not "$object"- you have the wrong variable name.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.