ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH
advanced | search help

Reference
ActivePerl 5.6
Modules
Win32
AuthenticateUser
ChangeNotify
Clipboard
Console
Event
EventLog
File
FileSecurity
Internet
IPC
Job
Mutex
NetAdmin
NetResource
ODBC
OLE
PerfLib
Pipe
Process
Registry
Semaphore
Service
Sound
TieRegistry
File
Net
Registry
RobotRules
Parser
Simple
Lite
Test
APItest
Typemap

MyASPN >> Reference >> ActivePerl 5.6 >> Modules >> Win32

 Win32::ChangeNotify - Monitor events related to files and directories


NAME

Win32::ChangeNotify - Monitor events related to files and directories


SYNOPSIS

        require Win32::ChangeNotify;
        $notify = Win32::ChangeNotify->new($Path,$WatchSubTree,$Events);
        $notify->wait or warn "Something failed: $!\n";
        # There has been a change.


DESCRIPTION

This module allows the user to use a Win32 change notification event object from Perl. This allows the Perl program to monitor events relating to files and directory trees.

The wait method and wait_all & wait_any functions are inherited from the Win32::IPC module.

Methods

$notify = Win32::ChangeNotify->new($path, $subtree, $filter)
Constructor for a new ChangeNotification object. $path is the directory to monitor. If $subtree is true, then all directories under $path will be monitored. $filter indicates what events should trigger a notification. It should be a string containing any of the following flags (separated by whitespace and/or |).
   ATTRIBUTES   Any attribute change
   DIR_NAME     Any directory name change
   FILE_NAME    Any file name change (creating/deleting/renaming)
   LAST_WRITE   Any change to a file's last write time
   SECURITY     Any security descriptor change
   SIZE         Any change in a file's size

($filter can also be an integer composed from the FILE_NOTIFY_CHANGE_* constants.)

$notify->close
Shut down monitoring. You could just undef $notify instead (but close works even if there are other copies of the object). This happens automatically when your program exits.

$notify->reset
Resets the ChangeNotification object after a change has been detected. The object will become signalled again after the next change. (It is OK to call this immediately after new, but it is not required.)

$notify->wait
See Win32::IPC. Remember to call reset afterwards if you want to continue monitoring.

Deprecated Functions and Methods

Win32::ChangeNotify still supports the ActiveWare syntax, but its use is deprecated.

FindFirst($Obj,$PathName,$WatchSubTree,$Filter)
Use
  $Obj = Win32::ChangeNotify->new($PathName,$WatchSubTree,$Filter)

instead.

$obj->FindNext()
Use $obj->reset instead.

$obj->Close()
Use $obj->close instead.


AUTHOR

Christopher J. Madsen <chris_madsen@geocities.com>

Loosely based on the original module by ActiveWare Internet Corp., http://www.ActiveWare.com

 Win32::ChangeNotify - Monitor events related to files and directories


Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved