line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2017 by Pali |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Exception::Class::Try::Catch; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
89901
|
use 5.006; |
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
10
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
7
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
82
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.2'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
10
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
12
|
1
|
|
|
1
|
|
1124
|
use Exception::Class::Base; |
|
1
|
|
|
|
|
15163
|
|
|
1
|
|
|
|
|
52
|
|
13
|
1
|
|
|
1
|
|
12
|
use Exporter 5.57 'import'; |
|
1
|
|
|
|
|
26
|
|
|
1
|
|
|
|
|
54
|
|
14
|
1
|
|
|
1
|
|
10
|
use Scalar::Util; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
56
|
|
15
|
1
|
|
|
1
|
|
660
|
use Try::Catch qw(try); |
|
1
|
|
|
|
|
1064
|
|
|
1
|
|
|
|
|
343
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$Carp::Internal{+__PACKAGE__} = 1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @EXPORT_OK = qw(try catch); |
20
|
|
|
|
|
|
|
our @EXPORT = @EXPORT_OK; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub catch (&) { |
23
|
17
|
|
|
17
|
0
|
18687
|
my $block = $_[0]; |
24
|
|
|
|
|
|
|
$_[0] = sub { |
25
|
15
|
|
|
15
|
|
2778
|
my $error = $_[0]; |
26
|
15
|
100
|
100
|
|
|
112
|
if (Scalar::Util::blessed($error) and not $error->isa('Exception::Class::Base')) { |
27
|
3
|
100
|
|
|
|
32
|
$error = $error->as_string() if $error->can('as_string'); |
28
|
3
|
|
|
|
|
39
|
$error = "$error"; |
29
|
|
|
|
|
|
|
} |
30
|
15
|
100
|
|
|
|
49
|
if (not Scalar::Util::blessed($error)) { |
31
|
8
|
|
|
|
|
23
|
$_[0] = $_ = Exception::Class::Base->new($error); |
32
|
|
|
|
|
|
|
} |
33
|
15
|
|
|
|
|
2149
|
goto &$block; |
34
|
17
|
|
|
|
|
62
|
}; |
35
|
17
|
|
|
|
|
58
|
goto &Try::Catch::catch; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |