The problem is that I only can return if the directory was modified or not. I'd like to get the names of the new files.
I understood by reading the File::Monitor and File::Monitor::Delta documentation that I must build a "callback" for each modification I want to watch, but I can't figure where to do that in my code...
That's what I have:
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- use strict;
- use File::Monitor;
- ### use File::Monitor::Object;
- use File::Monitor::Delta;
- my $monitor = File::Monitor->new();
- # Watch a directory
- $monitor->watch('/home/joao/PERLFOLDER');
- while (1){
- my @changes=$monitor->scan;
- for my $change (@changes) {
- warn $change->name, " has changes\n";
- }
- sleep 1;
- }
thanks,
Joćo