/usr/lib/perl5/APR/Status.pm is in libapache2-mod-perl2 2.0.5-5ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | #
# /*
# * *********** WARNING **************
# * This file generated by ModPerl::WrapXS/0.01
# * Any changes made here will be lost
# * ***********************************
# * 01: lib/ModPerl/Code.pm:709
# * 02: lib/ModPerl/WrapXS.pm:626
# * 03: lib/ModPerl/WrapXS.pm:1175
# * 04: Makefile.PL:424
# * 05: Makefile.PL:326
# * 06: Makefile.PL:57
# */
#
package APR::Status;
use strict;
use warnings FATAL => 'all';
use APR ();
use APR::XSLoader ();
our $VERSION = '0.009000';
APR::XSLoader::load __PACKAGE__;
1;
__END__
=head1 NAME
APR::Status - Perl Interface to the APR_STATUS_IS_* macros
=head1 Synopsis
use APR::Status ();
eval { $obj->mp_method() };
if ($@ && $ref $@ eq 'APR::Error' && APR::Status::is_EAGAIN($@)) {
# APR_STATUS_IS_EAGAIN(s) of apr_errno.h is satisfied
}
=head1 Description
An interface to F<apr_errno.h> composite error codes.
As discussed in the C<L<APR::Error|docs::2.0::api::APR::Error>>
manpage, it is possible to handle APR/Apache/mod_perl exceptions in
the following way:
eval { $obj->mp_method() };
if ($@ && $ref $@ eq 'APR::Error' && $@ == $some_code)
warn "handled exception: $@";
}
However, in cases where C<$some_code> is an L<APR::Const
constant|docs::2.0::api::APR::Const>, there may be more than one
condition satisfying the intent of this exception. For this purpose
the APR C library provides in F<apr_errno.h> a series of macros,
C<APR_STATUS_IS_*>, which are the recommended way to check for such
conditions. For example, the C<APR_STATUS_IS_EAGAIN> macro is defined
as
#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
|| (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
|| (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \
|| (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION)
The purpose of C<APR::Status> is to provide functions corresponding
to these macros.
=head1 Functions
=head2 C<is_EACCES>
Check if the error is matching C<EACCES> and its variants (corresponds
to the C<APR_STATUS_IS_EACCES> macro).
$status = APR::Status::is_EACCES($error_code);
=over 4
=item arg1: C<$error_code> (integer or C<L<APR::Error
object|docs::2.0::api::APR::Error>> )
The error code or to check, normally C<$@> blessed into C<L<APR::Error
object|docs::2.0::api::APR::Error>>.
=item ret: C<$status> ( boolean )
=item since: 2.0.00
=back
An example of using C<is_EACCES> is when reading the contents of a
file where access may be forbidden:
eval { $obj->slurp_filename(0) };
if ($@) {
return Apache2::Const::FORBIDDEN
if ref $@ eq 'APR::Error' && APR::Status::is_EACCES($@);
die $@;
}
Due to possible variants in conditions matching C<EACCES>,
the use of this function is recommended for checking error codes
against this value, rather than just using
C<L<APR::Const::EACCES|docs::2.0::api::APR::Const/C_APR__Const__EACCES_>>
directly.
=head2 C<is_EAGAIN>
Check if the error is matching C<EAGAIN> and its variants (corresponds
to the C<APR_STATUS_IS_EAGAIN> macro).
$status = APR::Status::is_EAGAIN($error_code);
=over 4
=item arg1: C<$error_code> (integer or C<L<APR::Error
object|docs::2.0::api::APR::Error>> )
The error code or to check, normally C<$@> blessed into C<L<APR::Error
object|docs::2.0::api::APR::Error>>.
=item ret: C<$status> ( boolean )
=item since: 2.0.00
=back
For example, here is how you may want to handle socket read exceptions
and do retries:
use APR::Status ();
# ....
my $tries = 0;
my $buffer;
RETRY: my $rlen = eval { $socket->recv($buffer, SIZE) };
if ($@ && ref($@) && APR::Status::is_EAGAIN($@)) {
if ($tries++ < 3) {
goto RETRY;
}
else {
# do something else
}
}
else {
die "eval block has failed: $@";
}
Notice that just checking against
C<L<APR::Const::EAGAIN|docs::2.0::api::APR::Const/C_APR__Const__EAGAIN_>>
may work on some Unices, but then it will certainly break on
win32. Thefore make sure to use this macro and not
C<APR::Const::EAGAIN> unless you know what you are doing.
=head2 C<is_ENOENT>
Check if the error is matching C<ENOENT> and its variants (corresponds
to the C<APR_STATUS_IS_ENOENT> macro).
$status = APR::Status::is_ENOENT($error_code);
=over 4
=item arg1: C<$error_code> (integer or C<L<APR::Error
object|docs::2.0::api::APR::Error>> )
The error code or to check, normally C<$@> blessed into C<L<APR::Error
object|docs::2.0::api::APR::Error>>.
=item ret: C<$status> ( boolean )
=item since: 2.0.00
=back
An example of using C<is_ENOENT> is when reading the contents of a
file which may not exist:
eval { $obj->slurp_filename(0) };
if ($@) {
return Apache2::Const::NOT_FOUND
if ref $@ eq 'APR::Error' && APR::Status::is_ENOENT($@);
die $@;
}
Due to possible variants in conditions matching C<ENOENT>,
the use of this function is recommended for checking error codes
against this value, rather than just using
C<L<APR::Const::ENOENT|docs::2.0::api::APR::Const/C_APR__Const__ENOENT_>>
directly.
=head2 C<is_EOF>
Check if the error is matching C<EOF> and its variants (corresponds
to the C<APR_STATUS_IS_EOF> macro).
$status = APR::Status::is_EOF($error_code);
=over 4
=item arg1: C<$error_code> (integer or C<L<APR::Error
object|docs::2.0::api::APR::Error>> )
The error code or to check, normally C<$@> blessed into C<L<APR::Error
object|docs::2.0::api::APR::Error>>.
=item ret: C<$status> ( boolean )
=item since: 2.0.00
=back
Due to possible variants in conditions matching C<EOF>,
the use of this function is recommended for checking error codes
against this value, rather than just using
C<L<APR::Const::EOF|docs::2.0::api::APR::Const/C_APR__Const__EOF_>>
directly.
=head2 C<is_ECONNABORTED>
Check if the error is matching C<ECONNABORTED> and its variants (corresponds
to the C<APR_STATUS_IS_ECONNABORTED> macro).
$status = APR::Status::is_ECONNABORTED($error_code);
=over 4
=item arg1: C<$error_code> (integer or C<L<APR::Error
object|docs::2.0::api::APR::Error>> )
The error code or to check, normally C<$@> blessed into C<L<APR::Error
object|docs::2.0::api::APR::Error>>.
=item ret: C<$status> ( boolean )
=item since: 2.0.00
=back
Due to possible variants in conditions matching C<ECONNABORTED>,
the use of this function is recommended for checking error codes
against this value, rather than just using
C<L<APR::Const::ECONNABORTED|docs::2.0::api::APR::Const/C_APR__Const__ECONNABORTED_>> directly.
=head2 C<is_ECONNRESET>
Check if the error is matching C<ECONNRESET> and its variants
(corresponds to the C<APR_STATUS_IS_ECONNRESET> macro).
$status = APR::Status::is_ECONNRESET($error_code);
=over 4
=item arg1: C<$error_code> (integer or C<L<APR::Error
object|docs::2.0::api::APR::Error>> )
The error code or to check, normally C<$@> blessed into C<L<APR::Error
object|docs::2.0::api::APR::Error>>.
=item ret: C<$status> ( boolean )
=item since: 2.0.00
=back
Due to possible variants in conditions matching C<ECONNRESET>, the use
of this function is recommended for checking error codes against this
value, rather than just using
C<L<APR::Const::ECONNRESET|docs::2.0::api::APR::Const/C_APR__Const__ECONNRESET_>>
directly.
=head2 C<is_TIMEUP>
Check if the error is matching C<TIMEUP> and its variants (corresponds
to the C<APR_STATUS_IS_TIMEUP> macro).
$status = APR::Status::is_TIMEUP($error_code);
=over 4
=item arg1: C<$error_code> (integer or C<L<APR::Error
object|docs::2.0::api::APR::Error>> )
The error code or to check, normally C<$@> blessed into C<L<APR::Error
object|docs::2.0::api::APR::Error>>.
=item ret: C<$status> ( boolean )
=item since: 2.0.00
=back
Due to possible variants in conditions matching C<TIMEUP>,
the use of this function is recommended for checking error codes
against this value, rather than just using
C<L<APR::Const::TIMEUP|docs::2.0::api::APR::Const/C_APR__Const__TIMEUP_>>
directly.
=head1 See Also
L<mod_perl 2.0 documentation|docs::2.0::index>.
=head1 Copyright
mod_perl 2.0 and its core modules are copyrighted under
The Apache Software License, Version 2.0.
=head1 Authors
L<The mod_perl development team and numerous
contributors|about::contributors::people>.
=cut
|