source: for-distributions/trunk/bin/windows/perl/lib/Errno.pm@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 5.9 KB
Line 
1#
2# This file is auto-generated. ***ANY*** changes here will be lost
3#
4
5package Errno;
6our (@EXPORT_OK,%EXPORT_TAGS,@ISA,$VERSION,%errno,$AUTOLOAD);
7use Exporter ();
8use Config;
9use strict;
10
11"$Config{'archname'}-$Config{'osvers'}" eq
12"MSWin32-x86-multi-thread-5.1" or
13 die "Errno architecture (MSWin32-x86-multi-thread-5.1) does not match executable architecture ($Config{'archname'}-$Config{'osvers'})";
14
15$VERSION = "1.09_01";
16$VERSION = eval $VERSION;
17@ISA = qw(Exporter);
18
19@EXPORT_OK = qw(EROFS ESHUTDOWN EPROTONOSUPPORT ENFILE ENOLCK
20 EADDRINUSE ECONNABORTED EBADF EDEADLK ENOTDIR EINVAL ENOTTY EXDEV
21 ELOOP ECONNREFUSED EISCONN EFBIG ECONNRESET EPFNOSUPPORT ENOENT
22 EDISCON EWOULDBLOCK EDOM EMSGSIZE EDESTADDRREQ ENOTSOCK EIO ENOSPC
23 ENOBUFS EINPROGRESS ERANGE EADDRNOTAVAIL EAFNOSUPPORT ENOSYS EINTR
24 EHOSTDOWN EREMOTE EILSEQ ENOMEM ENOTCONN ENETUNREACH EPIPE ESTALE
25 EDQUOT EUSERS EOPNOTSUPP ESPIPE EALREADY EMFILE ENAMETOOLONG EACCES
26 ENOEXEC EISDIR EPROCLIM EBUSY E2BIG EPERM EEXIST ETOOMANYREFS
27 ESOCKTNOSUPPORT ETIMEDOUT ENXIO ESRCH ENODEV EFAULT EAGAIN EMLINK
28 EDEADLOCK ENOPROTOOPT ECHILD ENETDOWN EHOSTUNREACH EPROTOTYPE
29 ENETRESET ENOTEMPTY);
30
31%EXPORT_TAGS = (
32 POSIX => [qw(
33 E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY
34 EBADF EBUSY ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK
35 EDESTADDRREQ EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH
36 EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK
37 EMSGSIZE ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS
38 ENODEV ENOENT ENOEXEC ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTCONN
39 ENOTDIR ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM EPFNOSUPPORT
40 EPIPE EPROCLIM EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE EROFS
41 ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS
42 EUSERS EWOULDBLOCK EXDEV
43 )]
44);
45
46sub EPERM () { 1 }
47sub ENOENT () { 2 }
48sub ESRCH () { 3 }
49sub EINTR () { 4 }
50sub EIO () { 5 }
51sub ENXIO () { 6 }
52sub E2BIG () { 7 }
53sub ENOEXEC () { 8 }
54sub EBADF () { 9 }
55sub ECHILD () { 10 }
56sub EAGAIN () { 11 }
57sub ENOMEM () { 12 }
58sub EACCES () { 13 }
59sub EFAULT () { 14 }
60sub EBUSY () { 16 }
61sub EEXIST () { 17 }
62sub EXDEV () { 18 }
63sub ENODEV () { 19 }
64sub ENOTDIR () { 20 }
65sub EISDIR () { 21 }
66sub EINVAL () { 22 }
67sub ENFILE () { 23 }
68sub EMFILE () { 24 }
69sub ENOTTY () { 25 }
70sub EFBIG () { 27 }
71sub ENOSPC () { 28 }
72sub ESPIPE () { 29 }
73sub EROFS () { 30 }
74sub EMLINK () { 31 }
75sub EPIPE () { 32 }
76sub EDOM () { 33 }
77sub ERANGE () { 34 }
78sub EDEADLK () { 36 }
79sub EDEADLOCK () { 36 }
80sub ENAMETOOLONG () { 38 }
81sub ENOLCK () { 39 }
82sub ENOSYS () { 40 }
83sub ENOTEMPTY () { 41 }
84sub EILSEQ () { 42 }
85sub EWOULDBLOCK () { 10035 }
86sub EINPROGRESS () { 10036 }
87sub EALREADY () { 10037 }
88sub ENOTSOCK () { 10038 }
89sub EDESTADDRREQ () { 10039 }
90sub EMSGSIZE () { 10040 }
91sub EPROTOTYPE () { 10041 }
92sub ENOPROTOOPT () { 10042 }
93sub EPROTONOSUPPORT () { 10043 }
94sub ESOCKTNOSUPPORT () { 10044 }
95sub EOPNOTSUPP () { 10045 }
96sub EPFNOSUPPORT () { 10046 }
97sub EAFNOSUPPORT () { 10047 }
98sub EADDRINUSE () { 10048 }
99sub EADDRNOTAVAIL () { 10049 }
100sub ENETDOWN () { 10050 }
101sub ENETUNREACH () { 10051 }
102sub ENETRESET () { 10052 }
103sub ECONNABORTED () { 10053 }
104sub ECONNRESET () { 10054 }
105sub ENOBUFS () { 10055 }
106sub EISCONN () { 10056 }
107sub ENOTCONN () { 10057 }
108sub ESHUTDOWN () { 10058 }
109sub ETOOMANYREFS () { 10059 }
110sub ETIMEDOUT () { 10060 }
111sub ECONNREFUSED () { 10061 }
112sub ELOOP () { 10062 }
113sub EHOSTDOWN () { 10064 }
114sub EHOSTUNREACH () { 10065 }
115sub EPROCLIM () { 10067 }
116sub EUSERS () { 10068 }
117sub EDQUOT () { 10069 }
118sub ESTALE () { 10070 }
119sub EREMOTE () { 10071 }
120sub EDISCON () { 10101 }
121
122sub TIEHASH { bless [] }
123
124sub FETCH {
125 my ($self, $errname) = @_;
126 my $proto = prototype("Errno::$errname");
127 my $errno = "";
128 if (defined($proto) && $proto eq "") {
129 no strict 'refs';
130 $errno = &$errname;
131 $errno = 0 unless $! == $errno;
132 }
133 return $errno;
134}
135
136sub STORE {
137 require Carp;
138 Carp::confess("ERRNO hash is read only!");
139}
140
141*CLEAR = \&STORE;
142*DELETE = \&STORE;
143
144sub NEXTKEY {
145 my($k,$v);
146 while(($k,$v) = each %Errno::) {
147 my $proto = prototype("Errno::$k");
148 last if (defined($proto) && $proto eq "");
149 }
150 $k
151}
152
153sub FIRSTKEY {
154 my $s = scalar keys %Errno::; # initialize iterator
155 goto &NEXTKEY;
156}
157
158sub EXISTS {
159 my ($self, $errname) = @_;
160 my $r = ref $errname;
161 my $proto = !$r || $r eq 'CODE' ? prototype($errname) : undef;
162 defined($proto) && $proto eq "";
163}
164
165tie %!, __PACKAGE__;
166
1671;
168__END__
169
170=head1 NAME
171
172Errno - System errno constants
173
174=head1 SYNOPSIS
175
176 use Errno qw(EINTR EIO :POSIX);
177
178=head1 DESCRIPTION
179
180C<Errno> defines and conditionally exports all the error constants
181defined in your system C<errno.h> include file. It has a single export
182tag, C<:POSIX>, which will export all POSIX defined error numbers.
183
184C<Errno> also makes C<%!> magic such that each element of C<%!> has a
185non-zero value only if C<$!> is set to that value. For example:
186
187 use Errno;
188
189 unless (open(FH, "/fangorn/spouse")) {
190 if ($!{ENOENT}) {
191 warn "Get a wife!\n";
192 } else {
193 warn "This path is barred: $!";
194 }
195 }
196
197If a specified constant C<EFOO> does not exist on the system, C<$!{EFOO}>
198returns C<"">. You may use C<exists $!{EFOO}> to check whether the
199constant is available on the system.
200
201=head1 CAVEATS
202
203Importing a particular constant may not be very portable, because the
204import will fail on platforms that do not have that constant. A more
205portable way to set C<$!> to a valid value is to use:
206
207 if (exists &Errno::EFOO) {
208 $! = &Errno::EFOO;
209 }
210
211=head1 AUTHOR
212
213Graham Barr <[email protected]>
214
215=head1 COPYRIGHT
216
217Copyright (c) 1997-8 Graham Barr. All rights reserved.
218This program is free software; you can redistribute it and/or modify it
219under the same terms as Perl itself.
220
221=cut
222
Note: See TracBrowser for help on using the repository browser.