home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / pc / software / entwickl / win95 / pw32i306.exe / lib / Win32 / file.pm < prev    next >
Text File  |  1996-10-14  |  2KB  |  100 lines

  1. package Win32::File;
  2.  
  3. #
  4. #File.pm
  5. #Written by Douglas_Lankshear@ActiveWare.com
  6. #
  7.  
  8. require Exporter;
  9. require DynaLoader;
  10.  
  11. @ISA= qw( Exporter DynaLoader );
  12. # Items to export into callers namespace by default. Note: do not export
  13. # names by default without a very good reason. Use EXPORT_OK instead.
  14. # Do not simply export all your public functions/methods/constants.
  15. @EXPORT = qw(
  16.         ARCHIVE
  17.         COMPRESSED
  18.         DIRECTORY
  19.         HIDDEN
  20.         NORMAL
  21.         READONLY
  22.         SYSTEM
  23.     );
  24.  
  25. =head1 NAME
  26.  
  27. Win32::File - manage file attributes in perl
  28.  
  29. =head1 SYNOPSIS
  30.  
  31.     use Win32::File;
  32.  
  33. =head1 DESCRIPTION
  34.  
  35. This module offers the retrieval and setting of file attributes.
  36.  
  37. =head1 FUNCTIONS
  38.  
  39. =head2 NOTE:
  40. all of the functions return FALSE (0) if they fail, unless otherwise noted.
  41.  
  42. =over 10
  43.  
  44. =item GetAttributes(filename, returnedAttirbutes)
  45.     Gets the attributes of a file or directory
  46.  
  47. =item SetAttributes(filename, newAttirbutes)
  48.     Sets the attributes of a file or directory
  49.  
  50. =back
  51.  
  52. =cut
  53.  
  54. sub AUTOLOAD 
  55. {
  56.     # This AUTOLOAD is used to 'autoload' constants from the constant()
  57.     # XS function.  If a constant is not found then control is passed
  58.     # to the AUTOLOAD in AutoLoader.
  59.  
  60.     my($constname);
  61.     ($constname = $AUTOLOAD) =~ s/.*:://;
  62.     #reset $! to zero to reset any current errors.
  63.     $!=0;
  64.     my $val = constant($constname, @_ ? $_[0] : 0);
  65.     if($! != 0)
  66.     {
  67.         if($! =~ /Invalid/)
  68.         {
  69.             $AutoLoader::AUTOLOAD = $AUTOLOAD;
  70.             goto &AutoLoader::AUTOLOAD;
  71.         }
  72.         else 
  73.         {
  74.             ($pack,$file,$line) = caller;
  75.             die "Your vendor has not defined Win32::File macro $constname, used in $file at line $line.";
  76.         }
  77.     }
  78.     eval "sub $AUTOLOAD { $val }";
  79.     goto &$AUTOLOAD;
  80. }
  81.  
  82. bootstrap Win32::File;
  83.  
  84. # Preloaded methods go here.
  85.  
  86. # Autoload methods go after __END__, and are processed by the autosplit program.
  87.  
  88. 1;
  89. __END__
  90.     
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.