line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Data::Seek Exception Class |
2
|
|
|
|
|
|
|
package Data::Seek::Exception; |
3
|
|
|
|
|
|
|
|
4
|
8
|
|
|
8
|
|
5674
|
use Data::Dumper (); |
|
8
|
|
|
|
|
32304
|
|
|
8
|
|
|
|
|
148
|
|
5
|
8
|
|
|
8
|
|
44
|
use Scalar::Util (); |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
80
|
|
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
742
|
use Data::Object::Class; |
|
8
|
|
|
|
|
20408
|
|
|
8
|
|
|
|
|
52
|
|
8
|
|
|
|
|
|
|
|
9
|
8
|
|
|
8
|
|
3265
|
use overload fallback => 1, '""' => \&as_string; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
58
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.06'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'code', is => 'ro'; |
14
|
|
|
|
|
|
|
has 'file', is => 'ro'; |
15
|
|
|
|
|
|
|
has 'line', is => 'ro'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'message' => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
default => sub { 'An exception occurred in class (' . ref(shift) . ')' }, |
20
|
|
|
|
|
|
|
lazy => 1 |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has 'package', is => 'ro'; |
24
|
|
|
|
|
|
|
has 'subroutine', is => 'ro'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub as_string { |
27
|
1
|
|
|
1
|
0
|
1041
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
4
|
return sprintf "%s at %s line %s\n", |
30
|
|
|
|
|
|
|
$self->message, $self->file, $self->line; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub caught { |
34
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
35
|
0
|
|
|
|
|
0
|
my $e = shift; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
0
|
|
|
0
|
return ! ref $class |
38
|
|
|
|
|
|
|
&& Scalar::Util::blessed($e) |
39
|
|
|
|
|
|
|
&& UNIVERSAL::isa($e, $class); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub dumper { |
43
|
0
|
|
|
0
|
0
|
0
|
local $Data::Dumper::Terse = 1; |
44
|
0
|
|
|
|
|
0
|
return Data::Dumper::Dumper(pop); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub rethrow { |
48
|
0
|
|
|
0
|
0
|
0
|
die shift; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub throw { |
52
|
15
|
|
|
15
|
0
|
1313
|
my ($class, %args) = @_; |
53
|
|
|
|
|
|
|
|
54
|
15
|
|
|
|
|
73
|
$args{subroutine} = (caller(1))[3]; |
55
|
15
|
|
|
|
|
55
|
$args{package} = (caller(0))[0]; |
56
|
15
|
|
|
|
|
37
|
$args{file} = (caller(0))[1]; |
57
|
15
|
|
|
|
|
36
|
$args{line} = (caller(0))[2]; |
58
|
|
|
|
|
|
|
|
59
|
15
|
|
|
|
|
237
|
die $class->new(%args); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub throw_subclass { |
63
|
1
|
|
|
1
|
0
|
1195
|
my ($class, $subspace, %args) = @_; |
64
|
1
|
|
|
|
|
3
|
my $subclass = join '::', $class, $subspace; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# gen exception sub-class dynamically if not loaded |
67
|
1
|
|
|
1
|
|
2
|
eval "package ${subclass}; use parent '@{[$class]}'; 1;"; |
|
1
|
|
|
|
|
57
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# throw generated exception |
70
|
1
|
|
|
|
|
4
|
@_ = ($class, %args); |
71
|
1
|
|
|
|
|
11
|
goto $subclass->can('throw'); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |