line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Alloy::Exception; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Template::Alloy::Exception - Handle exceptions |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
8
|
|
|
|
|
|
|
|
9
|
10
|
|
|
10
|
|
57
|
use strict; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
388
|
|
10
|
10
|
|
|
10
|
|
56
|
use warnings; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
705
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use overload |
13
|
|
|
|
|
|
|
'""' => \&as_string, |
14
|
3016
|
|
|
3016
|
|
11242
|
bool => sub { defined shift }, |
15
|
10
|
|
|
10
|
|
60
|
fallback => 1; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
141
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
522
|
|
|
522
|
0
|
1430
|
my ($class, $type, $info, $node, $pos, $doc) = @_; |
19
|
522
|
|
|
|
|
8646
|
return bless [$type, $info, $node, $pos, $doc], $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1559
|
|
|
1559
|
0
|
12467
|
sub type { $_[0]->[0] } |
23
|
193
|
100
|
|
193
|
0
|
535
|
sub info { $_[0]->[1] = $_[1] if @_ >= 2; $_[0]->[1] } |
|
193
|
|
|
|
|
1406
|
|
24
|
58
|
100
|
|
58
|
0
|
195
|
sub node { $_[0]->[2] = $_[1] if @_ >= 2; $_[0]->[2] } |
|
58
|
|
|
|
|
316
|
|
25
|
0
|
0
|
|
0
|
0
|
0
|
sub offset { $_[0]->[3] = $_[1] if @_ >= 2; $_[0]->[3] } |
|
0
|
|
|
|
|
0
|
|
26
|
628
|
100
|
|
628
|
0
|
2974
|
sub doc { $_[0]->[4] = $_[1] if @_ >= 2; $_[0]->[4] } |
|
628
|
|
|
|
|
3165
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub as_string { |
29
|
45
|
|
|
45
|
0
|
163
|
my $self = shift; |
30
|
45
|
50
|
|
|
|
130
|
if ($self->type =~ /^parse/) { |
31
|
0
|
0
|
|
|
|
0
|
if (my $doc = $self->doc) { |
32
|
0
|
|
|
|
|
0
|
my ($line, $char) = Template::Alloy->get_line_number_by_index($doc, $self->offset, 'include_char'); |
33
|
0
|
|
|
|
|
0
|
return $self->type ." error - $doc->{'name'} line $line char $char: ". $self->info; |
34
|
|
|
|
|
|
|
} else { |
35
|
0
|
|
|
|
|
0
|
return $self->type .' error - '. $self->info .' (At char '. $self->offset .')'; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} else { |
38
|
45
|
|
|
|
|
117
|
return $self->type .' error - '. $self->info; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
###----------------------------------------------------------------### |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |