line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::CuteQueries::Error; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
109
|
use strict; |
|
21
|
|
|
|
|
42
|
|
|
21
|
|
|
|
|
731
|
|
4
|
21
|
|
|
21
|
|
99
|
use warnings; |
|
21
|
|
|
|
|
36
|
|
|
21
|
|
|
|
|
5210
|
|
5
|
21
|
|
|
21
|
|
120
|
use Carp; |
|
21
|
|
|
|
|
42
|
|
|
21
|
|
|
|
|
1649
|
|
6
|
21
|
|
|
21
|
|
138
|
use Config; |
|
21
|
|
|
|
|
157
|
|
|
21
|
|
|
|
|
1896
|
|
7
|
21
|
|
|
21
|
|
66201
|
use overload '""' => "_stringify", fallback=>1; |
|
21
|
|
|
|
|
30700
|
|
|
21
|
|
|
|
|
342
|
|
8
|
21
|
|
|
21
|
|
1576
|
use base 'Class::Accessor'; __PACKAGE__->mk_accessors(qw(type text)); |
|
21
|
|
|
|
|
38
|
|
|
21
|
|
|
|
|
23152
|
|
9
|
|
|
|
|
|
|
|
10
|
21
|
|
|
21
|
|
83598
|
use constant QUERY_ERROR => 1; |
|
21
|
|
|
|
|
46
|
|
|
21
|
|
|
|
|
1867
|
|
11
|
21
|
|
|
21
|
|
109
|
use constant DATA_ERROR => 2; |
|
21
|
|
|
|
|
42
|
|
|
21
|
|
|
|
|
1137
|
|
12
|
|
|
|
|
|
|
|
13
|
21
|
|
|
21
|
|
145
|
use constant UNKNOWN => 9_999; |
|
21
|
|
|
|
|
37
|
|
|
21
|
|
|
|
|
15238
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $USEDBY = "???"; |
16
|
21
|
|
|
21
|
|
60
|
sub import { $USEDBY = caller; return } |
|
21
|
|
|
|
|
578
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# new {{{ |
19
|
|
|
|
|
|
|
sub new { |
20
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
21
|
0
|
|
|
|
|
|
my $this = bless {type=>UNKNOWN, text=>"unknown", @_, map {$_=>"unknown"} qw(ub_file ub_line file line package caller)}, $class; |
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# This is ripped off from IPC::System::Simple::Exception, it's pretty hot |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my ($package, $file, $line, $sub); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $depth = 0; |
28
|
0
|
|
|
|
|
|
while (1) { |
29
|
0
|
|
|
|
|
|
($package, $file, $line, $sub) = CORE::caller($depth++); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Skip up the call stack until we find something outside |
32
|
|
|
|
|
|
|
# of the caller, $class or eval space |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
croak "This should probably be invoked inside modules designed to use it, rather than just raw as you have done" |
35
|
|
|
|
|
|
|
unless $package; |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if( $package->isa($USEDBY) ) { |
38
|
0
|
|
|
|
|
|
$this->{ub_file} = $file; |
39
|
0
|
|
|
|
|
|
$this->{ub_line} = $line; |
40
|
0
|
|
|
|
|
|
next; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
next if $package->isa($class); |
44
|
0
|
0
|
|
|
|
|
next if $package->isa(__PACKAGE__); |
45
|
0
|
0
|
|
|
|
|
next if $file =~ /^\(eval\s\d+\)$/; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
last; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# We now have everything correct, *except* for our subroutine |
51
|
|
|
|
|
|
|
# name. If it's __ANON__ or (eval), then we need to keep on |
52
|
|
|
|
|
|
|
# digging deeper into our stack to find the real name. However we |
53
|
|
|
|
|
|
|
# don't update our other information, since that will be correct |
54
|
|
|
|
|
|
|
# for our current exception. |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $first_guess_subroutine = $sub; |
57
|
0
|
|
0
|
|
|
|
while (defined $sub and $sub =~ /^\(eval\)$|::__ANON__$/) { |
58
|
0
|
|
|
|
|
|
$depth++; |
59
|
0
|
|
|
|
|
|
$sub = (CORE::caller($depth))[3]; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# If we end up falling out the bottom of our stack, then our |
63
|
|
|
|
|
|
|
# __ANON__ guess is the best we can get. This includes situations |
64
|
|
|
|
|
|
|
# where we were called from the top level of a program. |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if (not defined $sub) { |
67
|
0
|
|
|
|
|
|
$sub = $first_guess_subroutine; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$this->{package} = $package; |
71
|
0
|
|
|
|
|
|
$this->{file} = $file; |
72
|
0
|
|
|
|
|
|
$this->{line} = $line; |
73
|
0
|
|
|
|
|
|
$this->{caller} = $sub; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return $this; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
# }}} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub query_error { |
80
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
81
|
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
return 1 if $this->{type} == QUERY_ERROR; |
83
|
0
|
|
|
|
|
|
return; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub data_error { |
87
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
return 1 if $this->{type} == DATA_ERROR; |
90
|
0
|
|
|
|
|
|
return; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub throw { |
94
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
croak $this; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub _stringify { |
100
|
0
|
|
|
0
|
|
|
my $this = shift; |
101
|
0
|
|
|
|
|
|
my $type = $this->{type}; |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
return "DATA ERROR: $this->{text} at $this->{file} line $this->{line}\n" if $type == DATA_ERROR; |
104
|
0
|
0
|
|
|
|
|
return "QUERY ERROR: $this->{text} at $this->{file} line $this->{line}\n" if $type == QUERY_ERROR; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
return "UNKNOWN ERROR TYPE at $this->{ub_file} line $this->{ub_line}: $this->{text} or something at $this->{file} line $this->{line}\n"; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |