home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / Win32 / File.pm < prev    next >
Encoding:
Perl POD Document  |  1997-08-10  |  1.8 KB  |  95 lines

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