| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package ACME::Error; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 710 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 45 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 1 |  |  | 1 |  | 6 | use vars qw[$VERSION]; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 179 |  | 
| 6 |  |  |  |  |  |  | $VERSION = '0.03'; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub import { | 
| 9 | 1 |  |  | 1 |  | 8 | my $class = shift; | 
| 10 | 1 | 50 |  |  |  | 1948 | if ( my $style = shift ) { | 
| 11 | 0 |  |  |  |  |  | my $package = qq[ACME::Error::$style]; | 
| 12 | 0 |  |  |  |  |  | my $args    = join q[', '], @_; | 
| 13 | 0 |  |  |  |  |  | eval qq[use $package '$args']; | 
| 14 | 0 | 0 |  |  |  |  | die $@ if $@; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 0 |  |  |  |  |  | my $nested = -1; | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 1 |  |  | 1 |  | 6 | { no strict 'refs'; | 
|  | 1 |  |  |  |  | 5 |  | 
|  | 1 |  |  |  |  | 232 |  | 
|  | 0 |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | $SIG{__WARN__} = sub { | 
| 20 | 0 |  |  | 0 |  |  | local $SIG{__WARN__}; | 
| 21 | 0 |  |  |  |  |  | $nested++; | 
| 22 | 0 |  |  |  |  |  | my $handler = $package . q[::warn_handler]; | 
| 23 | 0 | 0 |  |  |  |  | warn &{$handler}(@_) unless $nested; | 
|  | 0 |  |  |  |  |  |  | 
| 24 | 0 | 0 |  |  |  |  | warn @_ if $nested; | 
| 25 | 0 |  |  |  |  |  | $nested--; | 
| 26 | 0 |  |  |  |  |  | }; | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | $SIG{__DIE__}  = sub { | 
| 29 | 0 |  |  | 0 |  |  | local $SIG{__DIE__}; | 
| 30 | 0 |  |  |  |  |  | $nested++; | 
| 31 | 0 |  |  |  |  |  | my $handler = $package . q[::die_handler]; | 
| 32 | 0 | 0 |  |  |  |  | die &{$handler}(@_) unless $nested; | 
|  | 0 |  |  |  |  |  |  | 
| 33 | 0 | 0 |  |  |  |  | die @_ if $nested; | 
| 34 | 0 |  |  |  |  |  | $nested--; | 
| 35 | 0 |  |  |  |  |  | }; | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | #    $SIG{__WARN__} = sub { | 
| 39 |  |  |  |  |  |  | #      my $handler = $package . q[::warn_handler]; | 
| 40 |  |  |  |  |  |  | #      { | 
| 41 |  |  |  |  |  |  | #       no strict 'refs'; | 
| 42 |  |  |  |  |  |  | #       warn &{$handler} , "\n" if exists &{$handler}; | 
| 43 |  |  |  |  |  |  | #      } | 
| 44 |  |  |  |  |  |  | #    }; | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | #    $SIG{__DIE__}  = sub { | 
| 47 |  |  |  |  |  |  | #      my $handler = $package . q[::die_handler]; | 
| 48 |  |  |  |  |  |  | #      { | 
| 49 |  |  |  |  |  |  | #       no strict 'refs'; | 
| 50 |  |  |  |  |  |  | #       die &{$handler}, "\n" if exists &{$handler}; | 
| 51 |  |  |  |  |  |  | #      } | 
| 52 |  |  |  |  |  |  | #    }; | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | 1; | 
| 57 |  |  |  |  |  |  | __END__ |