line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::ExceptionManager; |
2
|
6
|
|
|
6
|
|
26338
|
use strict; |
|
6
|
|
|
|
|
31
|
|
|
6
|
|
|
|
|
185
|
|
3
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
148
|
|
4
|
6
|
|
|
6
|
|
149
|
use 5.00800; |
|
6
|
|
|
|
|
22
|
|
|
6
|
|
|
|
|
1946
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
1
|
811
|
sub detach { die bless [@_], 'CGI::ExceptionManager::Exception' } |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $stacktrace_required; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub run { |
12
|
6
|
|
|
6
|
1
|
1657
|
my ($class, %args) = @_; |
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
|
|
10
|
my $response; |
15
|
|
|
|
|
|
|
my $err_info; |
16
|
|
|
|
|
|
|
local $SIG{__DIE__} = sub { |
17
|
6
|
|
|
6
|
|
66
|
my ($msg) = @_; |
18
|
6
|
100
|
|
|
|
34
|
if (ref $msg eq 'CGI::ExceptionManager::Exception') { |
19
|
2
|
|
|
|
|
5
|
$response = $msg->[0]; |
20
|
2
|
|
|
|
|
4
|
undef $err_info; |
21
|
|
|
|
|
|
|
} else { |
22
|
4
|
100
|
|
|
|
20
|
unless ($stacktrace_required) { |
23
|
3
|
|
|
|
|
2360
|
require CGI::ExceptionManager::StackTrace; |
24
|
3
|
|
|
|
|
11
|
$stacktrace_required = 1; |
25
|
|
|
|
|
|
|
} |
26
|
4
|
|
|
|
|
26
|
$err_info = CGI::ExceptionManager::StackTrace->new($msg); |
27
|
|
|
|
|
|
|
} |
28
|
6
|
|
|
|
|
45
|
die $msg; |
29
|
6
|
|
|
|
|
58
|
}; |
30
|
6
|
|
|
|
|
14
|
local $@; |
31
|
6
|
|
|
|
|
13
|
eval { |
32
|
6
|
|
|
|
|
28
|
$response = $args{callback}->(); |
33
|
1
|
|
|
|
|
5
|
undef $err_info; |
34
|
|
|
|
|
|
|
}; |
35
|
6
|
100
|
|
|
|
37
|
if ($err_info) { |
36
|
3
|
100
|
100
|
|
|
28
|
$err_info->output( |
37
|
|
|
|
|
|
|
powered_by => $args{powered_by} || __PACKAGE__, |
38
|
|
|
|
|
|
|
($args{renderer} ? (renderer => $args{renderer}) : ()) |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
6
|
|
|
|
|
286
|
return $response; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
__END__ |