line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
45
|
|
2
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::InvalidEntityException; |
5
|
|
|
|
|
|
|
$Footprintless::InvalidEntityException::VERSION = '1.26'; |
6
|
|
|
|
|
|
|
# ABSTRACT: An exception thrown when an entity is invalid for the context it is being used in |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::InvalidEntityException |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
9
|
use Term::ANSIColor; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
97
|
|
10
|
2
|
|
|
2
|
|
10
|
use overload '""' => 'to_string'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
2
|
|
|
2
|
1
|
8
|
return bless( {}, shift )->_init(@_); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _init { |
17
|
2
|
|
|
2
|
|
5
|
my ( $self, $coordinate, $message ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
24
|
$self->{coordinate} = $coordinate; |
20
|
2
|
|
|
|
|
4
|
$self->{message} = $message; |
21
|
2
|
|
|
|
|
3
|
$self->{trace} = []; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
12
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_coordinate { |
27
|
0
|
|
|
0
|
1
|
0
|
return $_[0]->{coordinate}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_message { |
31
|
2
|
|
|
2
|
1
|
12
|
return $_[0]->{message}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub get_trace { |
35
|
0
|
|
|
0
|
1
|
|
return $_[0]->{trace}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub PROPAGATE { |
39
|
0
|
|
|
0
|
0
|
|
my ( $self, $file, $line ) = @_; |
40
|
0
|
|
|
|
|
|
push( @{ $self->{trace} }, [ $file, $line ] ); |
|
0
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub to_string { |
44
|
0
|
|
|
0
|
1
|
|
my ( $self, $trace ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my @parts = ("invalid entity at [$self->{coordinate}]: $self->{message}"); |
47
|
0
|
0
|
0
|
|
|
|
if ( $trace && @{ $self->{trace} } ) { |
|
0
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
push( @parts, "\n****TRACE****" ); |
49
|
0
|
|
|
|
|
|
foreach my $stop ( @{ $self->{trace} } ) { |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
push( @parts, "$stop->[0]($stop->[1])" ); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
push( @parts, "\n****TRACE****" ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return join( '', @parts ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |