| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
8
|
|
|
8
|
|
154064
|
use v5.42; |
|
|
8
|
|
|
|
|
54
|
|
|
2
|
8
|
|
|
8
|
|
55
|
use feature 'class'; |
|
|
8
|
|
|
|
|
19
|
|
|
|
8
|
|
|
|
|
1388
|
|
|
3
|
8
|
|
|
8
|
|
88
|
no warnings 'experimental::class'; |
|
|
8
|
|
|
|
|
12
|
|
|
|
8
|
|
|
|
|
854
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
class At::Error 1.1 { |
|
6
|
8
|
|
|
8
|
|
53
|
use Carp qw[]; |
|
|
8
|
|
|
|
|
10
|
|
|
|
8
|
|
|
|
|
875
|
|
|
7
|
|
|
|
|
|
|
use overload |
|
8
|
1
|
|
|
1
|
|
5
|
bool => sub {0}, |
|
9
|
8
|
|
|
8
|
|
50
|
'""' => sub ( $s, $u, $q ) { $s->message }; |
|
|
8
|
|
|
0
|
|
13
|
|
|
|
8
|
|
|
|
|
115
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
10
|
|
|
|
|
|
|
field $message : param : reader; |
|
11
|
|
|
|
|
|
|
field $description : param : reader //= (); |
|
12
|
|
|
|
|
|
|
field $fatal : param : reader //= 0; |
|
13
|
|
|
|
|
|
|
field @stack; |
|
14
|
|
|
|
|
|
|
ADJUST { |
|
15
|
|
|
|
|
|
|
my $i = 0; |
|
16
|
|
|
|
|
|
|
while ( my $info = $self->_caller_info( ++$i ) ) { |
|
17
|
|
|
|
|
|
|
push @stack, $info; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
method _caller_info($i) { |
|
22
|
|
|
|
|
|
|
my ( $package, $filename, $line, $subroutine ) = caller($i); |
|
23
|
|
|
|
|
|
|
return unless $package; |
|
24
|
|
|
|
|
|
|
return { package => $package, file => $filename, line => $line, sub_name => $subroutine }; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
method throw() { |
|
28
|
|
|
|
|
|
|
my ( undef, $file, $line ) = caller(); |
|
29
|
|
|
|
|
|
|
my $msg = join "\n\t", sprintf( qq[%s at %s line %d\n], $message, $file, $line ), |
|
30
|
|
|
|
|
|
|
map { sprintf q[%s called at %s line %d], $_->{sub_name}, $_->{file}, $_->{line} } @stack; |
|
31
|
|
|
|
|
|
|
$fatal ? die "$msg\n" : warn "$msg\n"; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Compatibility with old At::Error |
|
35
|
|
|
|
|
|
|
sub import { |
|
36
|
24
|
|
|
24
|
|
79
|
my $class = shift; |
|
37
|
24
|
|
|
|
|
58
|
my $from = caller; |
|
38
|
8
|
|
|
8
|
|
5001
|
no strict 'refs'; |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
3440
|
|
|
39
|
24
|
100
|
|
|
|
123
|
my @syms = @_ ? @_ : qw[register throw]; |
|
40
|
24
|
|
|
|
|
54
|
for my $sym (@syms) { |
|
41
|
48
|
100
|
|
|
|
120
|
if ( $sym eq 'register' ) { |
|
|
|
50
|
|
|
|
|
|
|
42
|
24
|
|
|
|
|
44
|
*{ $from . '::register' } = \®ister; |
|
|
24
|
|
|
|
|
154
|
|
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
elsif ( $sym eq 'throw' ) { |
|
45
|
24
|
|
|
|
|
2343
|
*{ $from . '::throw' } = sub { |
|
46
|
775
|
|
|
775
|
|
1314
|
my $err = shift; |
|
47
|
775
|
50
|
33
|
|
|
5382
|
if ( builtin::blessed($err) && $err->isa('At::Error') ) { |
|
48
|
775
|
|
|
|
|
2124
|
$err->throw; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
else { |
|
51
|
0
|
|
|
|
|
0
|
die $err; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
24
|
|
|
|
|
108
|
}; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
35
|
|
|
35
|
1
|
224950
|
sub register( $name, $is_fatal = 0 ) { |
|
|
35
|
|
|
|
|
52
|
|
|
|
35
|
|
|
|
|
52
|
|
|
|
35
|
|
|
|
|
40
|
|
|
59
|
35
|
|
|
|
|
89
|
my ($from) = caller; |
|
60
|
8
|
|
|
8
|
|
52
|
no strict 'refs'; |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
1700
|
|
|
61
|
35
|
|
|
775
|
|
208
|
*{ $from . '::' . $name } = sub ( $msg, $desc = '' ) { |
|
|
775
|
|
|
|
|
1347
|
|
|
|
775
|
|
|
|
|
1361
|
|
|
|
775
|
|
|
|
|
1406
|
|
|
|
775
|
|
|
|
|
989
|
|
|
62
|
775
|
|
|
|
|
7759
|
At::Error->new( message => $msg, description => $desc, fatal => $is_fatal ); |
|
63
|
35
|
|
|
|
|
153
|
}; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
1; |
|
67
|
|
|
|
|
|
|
__END__ |