in reply to Re^2: Directory Monitor
in thread Directory Monitor

Personally, before checking for changes in file size, I would check and print what kinds of events the monitor sends you. Unfortunately, there is no easy way to ask the Delta about what it contains, so you will have to look at the raw contents using Data::Dumper and hope that they show what kinds of events get triggered by a change:

for my $change (@changes) { use Data::Dumper; warn "Got a change:"; warn Dumper $change;

Also, why are you calling chomp on an element of @changes? What do you expect @changes to contain?

Replies are listed 'Best First'.
Re^4: Directory Monitor
by perlmad (Sexton) on Jul 25, 2016 at 11:28 UTC

    But The event is not working while update the file in the directory

    # Called when file size changes $monitor->callback( size => sub { my ($file_name, $event, $change) = @_; warn "$file_name has changed size\n"; } );

      Yes. Maybe the output of Data::Dumper could help to see whether there was any event raised when a file is changed.

      I'm not sure what could make the module fail to notice a change, but maybe you're working in the wrong directory?