home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / mac / Software / entwickl / win95 / pw32i306.exe / lib / Win32 / changenotify.pm < prev    next >
Text File  |  1996-11-29  |  3KB  |  101 lines

  1. package Win32::ChangeNotify;
  2. use Carp;
  3.  
  4. =head1 NAME
  5.  
  6. ChangeNotify - monitor events related to files
  7.  
  8. =head1 SYNOPSIS
  9.  
  10.     use Win32::ChangeNotify;
  11.  
  12.     Win32::ChangeNotify::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 ChangeNotify 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.     my($constname);
  75.     ($constname = $AUTOLOAD) =~ s/.*:://;
  76.     #reset $! to zero to reset any current errors.
  77.     $!=0;
  78.     my $val = constant($constname, @_ ? $_[0] : 0);
  79.     if ($! != 0) {
  80.     if ($! =~ /Invalid/) {
  81.         $AutoLoader::AUTOLOAD = $AUTOLOAD;
  82.         goto &AutoLoader::AUTOLOAD;
  83.     }
  84.     else {
  85.         ($pack,$file,$line) = caller;
  86.         die "Your vendor has not defined Win32::ChangeNotify macro $constname, used at $file line $line.";
  87.     }
  88.     }
  89.     eval "sub $AUTOLOAD { $val }";
  90.     goto &$AUTOLOAD;
  91. }
  92.  
  93. bootstrap Win32::ChangeNotify;
  94.  
  95. # Preloaded methods go here.
  96.  
  97. # Autoload methods go after __END__, and are processed by the autosplit program.
  98.  
  99. 1;
  100. __END__
  101.