home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / Lib / Win32 / changenotification.pm next >
Encoding:
Perl POD Document  |  1996-01-17  |  2.6 KB  |  100 lines

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