line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Exception::Tiny; |
2
|
11
|
|
|
11
|
|
300874
|
use strict; |
|
11
|
|
|
|
|
30
|
|
|
11
|
|
|
|
|
392
|
|
3
|
11
|
|
|
11
|
|
63
|
use warnings; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
283
|
|
4
|
11
|
|
|
11
|
|
350
|
use 5.008005; |
|
11
|
|
|
|
|
40
|
|
|
11
|
|
|
|
|
6971
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.2.1'; |
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
13630
|
use Data::Dumper (); |
|
11
|
|
|
|
|
130603
|
|
|
11
|
|
|
|
|
329
|
|
8
|
11
|
|
|
11
|
|
110
|
use Scalar::Util (); |
|
11
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
524
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use overload |
11
|
11
|
|
|
11
|
|
718
|
bool => sub { 1 }, |
12
|
11
|
|
|
|
|
115
|
q{""} => 'as_string', |
13
|
11
|
|
|
11
|
|
80
|
fallback => 1; |
|
11
|
|
|
|
|
23
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
16
|
11
|
|
|
|
|
101
|
new => 1, |
17
|
|
|
|
|
|
|
ro => [qw/ message file line package subroutine /] |
18
|
11
|
|
|
11
|
|
12497
|
); |
|
11
|
|
|
|
|
15239
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub throw { |
22
|
16
|
|
|
16
|
1
|
10162
|
my $class = shift; |
23
|
|
|
|
|
|
|
|
24
|
16
|
|
|
|
|
33
|
my %args; |
25
|
16
|
100
|
|
|
|
71
|
if (@_ == 1) { |
26
|
7
|
|
|
|
|
23
|
$args{message} = shift; |
27
|
|
|
|
|
|
|
} else { |
28
|
9
|
|
|
|
|
31
|
%args = @_; |
29
|
|
|
|
|
|
|
} |
30
|
16
|
100
|
66
|
|
|
121
|
$args{message} = $class unless defined $args{message} && $args{message} ne ''; |
31
|
|
|
|
|
|
|
|
32
|
16
|
|
|
|
|
197
|
($args{package}, $args{file}, $args{line}) = caller(0); |
33
|
16
|
|
|
|
|
98
|
$args{subroutine} = (caller(1))[3]; |
34
|
|
|
|
|
|
|
|
35
|
16
|
|
|
|
|
178
|
die $class->new(%args); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub rethrow { |
39
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
40
|
1
|
|
|
|
|
11
|
die $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub as_string { |
44
|
3
|
|
|
3
|
1
|
4110
|
my $self = shift; |
45
|
3
|
|
|
|
|
21
|
sprintf '%s at %s line %s.', $self->message, $self->file, $self->line; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub dump { |
49
|
2
|
|
|
2
|
1
|
1002
|
local $Data::Dumper::Terse = 1; |
50
|
2
|
|
|
|
|
15
|
Data::Dumper::Dumper(shift); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub caught { |
54
|
24
|
|
|
24
|
1
|
1241
|
my($class, $e) = @_; |
55
|
24
|
50
|
|
|
|
60
|
return if ref $class; |
56
|
24
|
100
|
100
|
|
|
213
|
return unless Scalar::Util::blessed($e) && UNIVERSAL::isa($e, $class); |
57
|
12
|
|
|
|
|
44
|
$e; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |