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) }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^7: Question in Win32::ChangeNotify... by BrowserUk
in thread Question in Win32::ChangeNotify... by biswanath_c

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.