~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy-updates

« back to all changes in this revision

Viewing changes to WrapXS/APR/Error/Error.pm

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2004-08-19 06:23:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040819062348-jxl4koqbtvgm8v2t
Tags: 1.99.14-4
Remove the LFS CFLAGS, and build-dep against apache2-*-dev (>= 2.0.50-10)
as we're backing out of the apache2/apr ABI transition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
2
# /*
 
3
#  * *********** WARNING **************
 
4
#  * This file generated by ModPerl::WrapXS/0.01
 
5
#  * Any changes made here will be lost
 
6
#  * ***********************************
 
7
#  * 01: lib/ModPerl/Code.pm:699
 
8
#  * 02: lib/ModPerl/WrapXS.pm:540
 
9
#  * 03: lib/ModPerl/WrapXS.pm:1054
 
10
#  * 04: Makefile.PL:290
 
11
#  * 05: Makefile.PL:238
 
12
#  * 06: Makefile.PL:49
 
13
#  */
 
14
 
15
 
 
16
 
 
17
package APR::Error;
 
18
 
 
19
use strict;
 
20
use warnings FATAL => 'all';
 
21
 
 
22
 
 
23
use APR::XSLoader ();
 
24
our $VERSION = '0.01';
 
25
APR::XSLoader::load __PACKAGE__;
 
26
 
 
27
require Carp;
 
28
require Carp::Heavy;
 
29
 
 
30
use APR::Util ();
 
31
 
 
32
use overload
 
33
    nomethod => \&fatal,
 
34
    'bool'   => \&str,
 
35
    '=='     => \&num,
 
36
    '0+'     => \&num,
 
37
    '""'     => \&str;
 
38
 
 
39
sub fatal {  die __PACKAGE__ . ": Can't handle '$_[3]'" }
 
40
 
 
41
# normally the object is created on the C side, but if you want to
 
42
# create one from Perl, you can. just pass a hash with args:
 
43
# rc, file, line, func
 
44
sub new {
 
45
    my $class = shift;
 
46
    my %args = @_;
 
47
    bless \%args, $class;
 
48
}
 
49
 
 
50
sub str {
 
51
    sprintf "%s: %s at %s line %d", $_[0]->{func},
 
52
        APR::Error::strerror($_[0]->{rc}),
 
53
        $_[0]->{file}, $_[0]->{line};
 
54
}
 
55
 
 
56
sub num { $_[0]->{rc} }
 
57
 
 
58
# skip the wrappers from this package from the long callers trace
 
59
$Carp::CarpInternal{+__PACKAGE__}++;
 
60
 
 
61
# XXX: Carp::(confess|cluck) see no calls stack when Perl_croak is
 
62
# called with Nullch (which is the way execption objects are
 
63
# returned), so we fixup it here (doesn't quite work for croak
 
64
# caller).
 
65
sub cluck {
 
66
    if (ref $_[0] eq __PACKAGE__) {
 
67
        Carp::cluck("$_[0]->{func}: " .
 
68
                    APR::Error::strerror($_[0]->{rc}));
 
69
    }
 
70
    else {
 
71
        &Carp::cluck;
 
72
    }
 
73
}
 
74
 
 
75
sub confess {
 
76
    if (ref $_[0] eq __PACKAGE__) {
 
77
        Carp::confess("$_[0]->{func}: " .
 
78
                    APR::Error::strerror($_[0]->{rc}));
 
79
    }
 
80
    else {
 
81
        &Carp::confess;
 
82
    }
 
83
}
 
84
 
 
85
1;
 
86
__END__
 
87
 
 
88
 
 
89
1;
 
90
__END__