You specify the flags on the constructor:
$notify = Win32::ChangeNotify->new($path, $subtree, 'FILE_NAME | LAST_ +WRITE' );
$nofify->wait; will return for either type of event. It's then up to you to go off and find what changed by scanning the directory in question.
To simplify the discovery, you can create mutiple notify objects and then wait_any() (from Win32::Event), and then you what type of change you should look for:
use Win32::Event qw[ wait_any ]; ... my $notifyFileName = Win32::ChangeNotify->new($path, $subtree, 'FILE_N +AME' ); my $notifyLastWrite = Win32::ChangeNotify->new($path, $subtree, 'LAST_ +WRITE' ); my @nfys = ( $notifyFileName, $notifyLastWrite ); defined( my $signalled = wait_any( @notify, $timeout ) ) or die "Mutex error: $^E"; if( $signalled == 1 ) { ## Look for fine name change } elsif( $signalled == 2 ) { ## Look for last write change } elsif( $signalled < 0 ) { warn "Abaindoned mutex"; ## ? } else { ## Wait timed out (only if timeout used) }
In reply to Re^7: Question in Win32::ChangeNotify...
by BrowserUk
in thread Question in Win32::ChangeNotify...
by biswanath_c
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |