| 1 | package CGI::ExceptionManager; | ||||||||||||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 6 | ▶ | use 5.00800; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 6 | our $VERSION = '0.06'; | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | ▶ | sub detach { die bless [@_], 'CGI::ExceptionManager::Exception' } | ||||||||||||||||||
|
Subroutine
detach: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 6 | my $stacktrace_required; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | sub run { | ||||||||||||||||||||
| 12 | 6 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||
|
Subroutine
run: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 6 | my $response; | |||||||||||||||||||
| 15 | my $err_info; | ||||||||||||||||||||
| 16 | local $SIG{__DIE__} = sub { | ||||||||||||||||||||
| 17 | 6 | ▶ | my ($msg) = @_; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 18 | 6 | ▶ | if (ref $msg eq 'CGI::ExceptionManager::Exception') { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 19 | 2 | $response = $msg->[0]; | |||||||||||||||||||
| 20 | 2 | undef $err_info; | |||||||||||||||||||
| 21 | } else { | ||||||||||||||||||||
| 22 | 4 | ▶ | unless ($stacktrace_required) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | 3 | require CGI::ExceptionManager::StackTrace; | |||||||||||||||||||
| 24 | 3 | $stacktrace_required = 1; | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | 4 | $err_info = CGI::ExceptionManager::StackTrace->new($msg); | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | 6 | die $msg; | |||||||||||||||||||
| 29 | 6 | }; | |||||||||||||||||||
| 30 | 6 | local $@; | |||||||||||||||||||
| 31 | 6 | eval { | |||||||||||||||||||
| 32 | 6 | $response = $args{callback}->(); | |||||||||||||||||||
| 33 | 1 | undef $err_info; | |||||||||||||||||||
| 34 | }; | ||||||||||||||||||||
| 35 | 6 | ▶ | if ($err_info) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 36 | $err_info->output( | ||||||||||||||||||||
| 37 | powered_by => $args{powered_by} || __PACKAGE__, | ||||||||||||||||||||
| 38 | 3 | ▶ | ($args{renderer} ? (renderer => $args{renderer}) : ()) | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$args{'powered_by'} || __PACKAGE__
MC/DC100%1/1
$args{'powered_by'} || __PACKAGE__
$args{'powered_by'}
Truth table100%2/2
A
A= $args{'powered_by'}
| |||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | 6 | return $response; | |||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 6 | 1; | |||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||