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