Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
1.9 KiB

  1. package Win32::File;
  2. #
  3. # File.pm
  4. # Written by [email protected]
  5. #
  6. # subsequent hacks:
  7. # Gurusamy Sarathy
  8. #
  9. $VERSION = '0.05';
  10. require Exporter;
  11. require DynaLoader;
  12. @ISA= qw( Exporter DynaLoader );
  13. @EXPORT = qw(
  14. ARCHIVE
  15. COMPRESSED
  16. DIRECTORY
  17. HIDDEN
  18. NORMAL
  19. OFFLINE
  20. READONLY
  21. SYSTEM
  22. TEMPORARY
  23. );
  24. @EXPORT_OK = qw(GetAttributes SetAttributes);
  25. =head1 NAME
  26. Win32::File - manage file attributes in perl
  27. =head1 SYNOPSIS
  28. use Win32::File;
  29. =head1 DESCRIPTION
  30. This module offers the retrieval and setting of file attributes.
  31. =head1 Functions
  32. =head2 NOTE
  33. All of the functions return FALSE (0) if they fail, unless otherwise noted.
  34. The function names are exported into the caller's namespace by request.
  35. =over 10
  36. =item GetAttributes(filename, returnedAttributes)
  37. Gets the attributes of a file or directory. returnedAttributes will be set
  38. to the OR-ed combination of the filename attributes.
  39. =item SetAttributes(filename, newAttributes)
  40. Sets the attributes of a file or directory. newAttributes must be an OR-ed
  41. combination of the attributes.
  42. =back
  43. =head1 Constants
  44. The following constants are exported by default.
  45. =over 10
  46. =item ARCHIVE
  47. =item COMPRESSED
  48. =item DIRECTORY
  49. =item HIDDEN
  50. =item NORMAL
  51. =item OFFLINE
  52. =item READONLY
  53. =item SYSTEM
  54. =item TEMPORARY
  55. =back
  56. =cut
  57. sub AUTOLOAD
  58. {
  59. my($constname);
  60. ($constname = $AUTOLOAD) =~ s/.*:://;
  61. #reset $! to zero to reset any current errors.
  62. $!=0;
  63. my $val = constant($constname);
  64. if($! != 0)
  65. {
  66. if($! =~ /Invalid/)
  67. {
  68. $AutoLoader::AUTOLOAD = $AUTOLOAD;
  69. goto &AutoLoader::AUTOLOAD;
  70. }
  71. else
  72. {
  73. ($pack,$file,$line) = caller;
  74. die "Your vendor has not defined Win32::File macro $constname, used in $file at line $line.";
  75. }
  76. }
  77. eval "sub $AUTOLOAD { $val }";
  78. goto &$AUTOLOAD;
  79. }
  80. bootstrap Win32::File;
  81. 1;
  82. __END__