You can subscribe to Win32 ChangeNotify messages, which would let you know when a file changed for whatever reason. I'm not sure if this helps in your situation, but it is kinda cool. If you don't have Win32::ChangeNotify installed, you can get it via PPM if you run ActiveState ala "ppm install Win32-ChangeNotify" or from CPAN using "perl -MCPAN -e 'install Win32::ChangeNotify'". Here's some sample code:
use strict; my $logfile = "D:\\ChangeNotify.txt"; my $path = "D:\\"; use Win32::ChangeNotify; ChangeWatch(); sub ChangeWatch { #$filter can contain any of the below seperated by a | # #ATTRIBUTES Any attribute change #DIR_NAME Any directory name change #FILE_NAME Any file name change #LAST_WRITE Any change to a file's last write time #SECURITY Any security descriptor change #SIZE Any change in a file's size my $filter = LAST_WRITE; my ($path,$subtree); my $notify = Win32::ChangeNotify->new($path,$subtree,$filter); $notify->wait or warn "Something failed: $!\n"; Notify($path,$subtree); $notify->reset; ChangeWatch(); } sub Notify { my ($path,$subtree)=@_; open(FILE,">>$logfile) or die "could not optn $logfile: $!"; print FILE scalar localtime . "Change Detected at $path $subtree\n"; close FILE; }
-Vlad

In reply to Re: Making a perl program look like a regular file on Win32? by vladdrak
in thread Making a perl program look like a regular file on Win32? by SmugX

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.