1 | #
|
---|
2 | # This file is auto-generated. ***ANY*** changes here will be lost
|
---|
3 | #
|
---|
4 |
|
---|
5 | package Errno;
|
---|
6 | our (@EXPORT_OK,%EXPORT_TAGS,@ISA,$VERSION,%errno,$AUTOLOAD);
|
---|
7 | use Exporter ();
|
---|
8 | use Config;
|
---|
9 | use 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 |
|
---|
46 | sub EPERM () { 1 }
|
---|
47 | sub ENOENT () { 2 }
|
---|
48 | sub ESRCH () { 3 }
|
---|
49 | sub EINTR () { 4 }
|
---|
50 | sub EIO () { 5 }
|
---|
51 | sub ENXIO () { 6 }
|
---|
52 | sub E2BIG () { 7 }
|
---|
53 | sub ENOEXEC () { 8 }
|
---|
54 | sub EBADF () { 9 }
|
---|
55 | sub ECHILD () { 10 }
|
---|
56 | sub EAGAIN () { 11 }
|
---|
57 | sub ENOMEM () { 12 }
|
---|
58 | sub EACCES () { 13 }
|
---|
59 | sub EFAULT () { 14 }
|
---|
60 | sub EBUSY () { 16 }
|
---|
61 | sub EEXIST () { 17 }
|
---|
62 | sub EXDEV () { 18 }
|
---|
63 | sub ENODEV () { 19 }
|
---|
64 | sub ENOTDIR () { 20 }
|
---|
65 | sub EISDIR () { 21 }
|
---|
66 | sub EINVAL () { 22 }
|
---|
67 | sub ENFILE () { 23 }
|
---|
68 | sub EMFILE () { 24 }
|
---|
69 | sub ENOTTY () { 25 }
|
---|
70 | sub EFBIG () { 27 }
|
---|
71 | sub ENOSPC () { 28 }
|
---|
72 | sub ESPIPE () { 29 }
|
---|
73 | sub EROFS () { 30 }
|
---|
74 | sub EMLINK () { 31 }
|
---|
75 | sub EPIPE () { 32 }
|
---|
76 | sub EDOM () { 33 }
|
---|
77 | sub ERANGE () { 34 }
|
---|
78 | sub EDEADLK () { 36 }
|
---|
79 | sub EDEADLOCK () { 36 }
|
---|
80 | sub ENAMETOOLONG () { 38 }
|
---|
81 | sub ENOLCK () { 39 }
|
---|
82 | sub ENOSYS () { 40 }
|
---|
83 | sub ENOTEMPTY () { 41 }
|
---|
84 | sub EILSEQ () { 42 }
|
---|
85 | sub EWOULDBLOCK () { 10035 }
|
---|
86 | sub EINPROGRESS () { 10036 }
|
---|
87 | sub EALREADY () { 10037 }
|
---|
88 | sub ENOTSOCK () { 10038 }
|
---|
89 | sub EDESTADDRREQ () { 10039 }
|
---|
90 | sub EMSGSIZE () { 10040 }
|
---|
91 | sub EPROTOTYPE () { 10041 }
|
---|
92 | sub ENOPROTOOPT () { 10042 }
|
---|
93 | sub EPROTONOSUPPORT () { 10043 }
|
---|
94 | sub ESOCKTNOSUPPORT () { 10044 }
|
---|
95 | sub EOPNOTSUPP () { 10045 }
|
---|
96 | sub EPFNOSUPPORT () { 10046 }
|
---|
97 | sub EAFNOSUPPORT () { 10047 }
|
---|
98 | sub EADDRINUSE () { 10048 }
|
---|
99 | sub EADDRNOTAVAIL () { 10049 }
|
---|
100 | sub ENETDOWN () { 10050 }
|
---|
101 | sub ENETUNREACH () { 10051 }
|
---|
102 | sub ENETRESET () { 10052 }
|
---|
103 | sub ECONNABORTED () { 10053 }
|
---|
104 | sub ECONNRESET () { 10054 }
|
---|
105 | sub ENOBUFS () { 10055 }
|
---|
106 | sub EISCONN () { 10056 }
|
---|
107 | sub ENOTCONN () { 10057 }
|
---|
108 | sub ESHUTDOWN () { 10058 }
|
---|
109 | sub ETOOMANYREFS () { 10059 }
|
---|
110 | sub ETIMEDOUT () { 10060 }
|
---|
111 | sub ECONNREFUSED () { 10061 }
|
---|
112 | sub ELOOP () { 10062 }
|
---|
113 | sub EHOSTDOWN () { 10064 }
|
---|
114 | sub EHOSTUNREACH () { 10065 }
|
---|
115 | sub EPROCLIM () { 10067 }
|
---|
116 | sub EUSERS () { 10068 }
|
---|
117 | sub EDQUOT () { 10069 }
|
---|
118 | sub ESTALE () { 10070 }
|
---|
119 | sub EREMOTE () { 10071 }
|
---|
120 | sub EDISCON () { 10101 }
|
---|
121 |
|
---|
122 | sub TIEHASH { bless [] }
|
---|
123 |
|
---|
124 | sub 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 |
|
---|
136 | sub STORE {
|
---|
137 | require Carp;
|
---|
138 | Carp::confess("ERRNO hash is read only!");
|
---|
139 | }
|
---|
140 |
|
---|
141 | *CLEAR = \&STORE;
|
---|
142 | *DELETE = \&STORE;
|
---|
143 |
|
---|
144 | sub 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 |
|
---|
153 | sub FIRSTKEY {
|
---|
154 | my $s = scalar keys %Errno::; # initialize iterator
|
---|
155 | goto &NEXTKEY;
|
---|
156 | }
|
---|
157 |
|
---|
158 | sub 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 |
|
---|
165 | tie %!, __PACKAGE__;
|
---|
166 |
|
---|
167 | 1;
|
---|
168 | __END__
|
---|
169 |
|
---|
170 | =head1 NAME
|
---|
171 |
|
---|
172 | Errno - System errno constants
|
---|
173 |
|
---|
174 | =head1 SYNOPSIS
|
---|
175 |
|
---|
176 | use Errno qw(EINTR EIO :POSIX);
|
---|
177 |
|
---|
178 | =head1 DESCRIPTION
|
---|
179 |
|
---|
180 | C<Errno> defines and conditionally exports all the error constants
|
---|
181 | defined in your system C<errno.h> include file. It has a single export
|
---|
182 | tag, C<:POSIX>, which will export all POSIX defined error numbers.
|
---|
183 |
|
---|
184 | C<Errno> also makes C<%!> magic such that each element of C<%!> has a
|
---|
185 | non-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 |
|
---|
197 | If a specified constant C<EFOO> does not exist on the system, C<$!{EFOO}>
|
---|
198 | returns C<"">. You may use C<exists $!{EFOO}> to check whether the
|
---|
199 | constant is available on the system.
|
---|
200 |
|
---|
201 | =head1 CAVEATS
|
---|
202 |
|
---|
203 | Importing a particular constant may not be very portable, because the
|
---|
204 | import will fail on platforms that do not have that constant. A more
|
---|
205 | portable 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 |
|
---|
213 | Graham Barr <[email protected]>
|
---|
214 |
|
---|
215 | =head1 COPYRIGHT
|
---|
216 |
|
---|
217 | Copyright (c) 1997-8 Graham Barr. All rights reserved.
|
---|
218 | This program is free software; you can redistribute it and/or modify it
|
---|
219 | under the same terms as Perl itself.
|
---|
220 |
|
---|
221 | =cut
|
---|
222 |
|
---|