22.3. Win32::ChangeNotifyThis module provides access to Win32 change-notification objects, letting you monitor events relating to files and directory trees. The constructor for this class is new, which creates a ChangeNotify object for a specified path and indicates how it should be monitored: $ntfy = Win32::ChangeNotify->new(path, subtree, events); $ntfy->wait or warn "Something has failed: $!"); The function returns a reference to the object as $ntfy. path is the pathname of the directory to monitor. subtree is a Boolean value that, if true, forces the object to monitor all subdirectories of the object's path. The eventsparameter indicates the type of events that will trigger a notification. It can be one of the following string values:
The following methods are used on notification objects created by new.
$ntfy->close( ) Stops the monitoring done by the notification object and destroys the object. This happens automatically when the program exits.
$ntfy->wait([timeout]) The wait method is inherited from the Win32::IPC package. It waits for the notification object to signal when it detects a change. timeout is the maximum time to wait (in milliseconds). If timeout is omitted, the method waits forever. If timeout is 0, the function returns immediately. The function returns the following values:
Use reset on the object after wait if you wish to continue monitoring. Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|