home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / hiz / 09 / 09.exe / adynware.exe / perl / lib / site / Win32 / ChangeNotify.pm < prev    next >
Encoding:
Perl POD Document  |  1999-12-28  |  2.1 KB  |  100 lines

  1. package Win32::ChangeNotify;
  2. use Carp;
  3.  
  4. $VERSION = '0.01';
  5.  
  6. =head1 NAME
  7.  
  8. ChangeNotify - monitor events related to files
  9.  
  10. =head1 SYNOPSIS
  11.  
  12.     use Win32::ChangeNotify;
  13.  
  14.     Win32::ChangeNotify::FindFirst($Obj,$PathName,$WatchSubTreeFlag,$filter);
  15.     $Obj->FindNext();
  16.     $Obj->Wait(INFINITE) or warn "Something failed: $!\n";
  17.     $Obj->Close();
  18.  
  19.  
  20. =head1 DESCRIPTION
  21.  
  22. This module allows the user to create a change notification event object
  23. in Perl.  This object allows the Perl program to monitor events relating
  24. to files and directory trees.
  25.  
  26. =head1 MEMBERS
  27.  
  28. The ChangeNotify module is written entirely in C++. So here is a 
  29. list of the members etc. (Note: no functions are exported)
  30.  
  31. =over 8
  32.  
  33. =item FindFirst($Obj,$PathName,$WathSubTree,$Filter)
  34.  
  35. This is the constructor for the object. An instantiated object is
  36. returned in $Obj.
  37.     Args:
  38.     $Obj        The container for the created object.
  39.     $WatchSubTree    A boolean value defining whether the subtree
  40.             should be included.
  41.     $Filter        See the exported values below to see the options
  42.             for this.
  43.  
  44. =item FindNext()
  45.  
  46. This method starts the monitoring.
  47.  
  48. =item Wait( $TimeOut )
  49.  
  50. This method starts the waiting on the change.
  51.  
  52. =item Close()
  53.  
  54. This method stops the monitoring.
  55.  
  56. =back
  57.  
  58. =cut
  59.  
  60. use Win32::IPC;
  61. require Exporter;
  62. require DynaLoader;
  63. require AutoLoader;
  64.  
  65. @ISA = qw(Exporter DynaLoader Win32::IPC);
  66. @EXPORT = qw(
  67.     FILE_NOTIFY_CHANGE_ATTRIBUTES
  68.     FILE_NOTIFY_CHANGE_DIR_NAME
  69.     FILE_NOTIFY_CHANGE_FILE_NAME
  70.     FILE_NOTIFY_CHANGE_LAST_WRITE
  71.     FILE_NOTIFY_CHANGE_SECURITY
  72.     FILE_NOTIFY_CHANGE_SIZE
  73.     INFINITE
  74. );
  75.  
  76. sub AUTOLOAD {
  77.  
  78.     my($constname);
  79.     ($constname = $AUTOLOAD) =~ s/.*:://;
  80.     $!=0;
  81.     my $val = constant($constname, @_ ? $_[0] : 0);
  82.     if ($! != 0) {
  83.     if ($! =~ /Invalid/) {
  84.         $AutoLoader::AUTOLOAD = $AUTOLOAD;
  85.         goto &AutoLoader::AUTOLOAD;
  86.     }
  87.     else {
  88.         ($pack,$file,$line) = caller;
  89.         die "Your vendor has not defined Win32::ChangeNotify macro $constname, used at $file line $line.";
  90.     }
  91.     }
  92.     eval "sub $AUTOLOAD { $val }";
  93.     goto &$AUTOLOAD;
  94. }
  95.  
  96. bootstrap Win32::ChangeNotify;
  97.  
  98. 1;
  99. __END__
  100.