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
|
|
73
|
use strict; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
285
|
|
10
|
10
|
|
|
10
|
|
57
|
use warnings; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
598
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use overload |
13
|
|
|
|
|
|
|
'""' => \&as_string, |
14
|
3022
|
|
|
3022
|
|
9548
|
bool => sub { defined shift }, |
15
|
10
|
|
|
10
|
|
73
|
fallback => 1; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
123
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
522
|
|
|
522
|
0
|
1668
|
my ($class, $type, $info, $node, $pos, $doc) = @_; |
19
|
522
|
|
|
|
|
6579
|
return bless [$type, $info, $node, $pos, $doc], $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1559
|
|
|
1559
|
0
|
8571
|
sub type { $_[0]->[0] } |
23
|
193
|
100
|
|
193
|
0
|
526
|
sub info { $_[0]->[1] = $_[1] if @_ >= 2; $_[0]->[1] } |
|
193
|
|
|
|
|
1059
|
|
24
|
58
|
100
|
|
58
|
0
|
173
|
sub node { $_[0]->[2] = $_[1] if @_ >= 2; $_[0]->[2] } |
|
58
|
|
|
|
|
217
|
|
25
|
0
|
0
|
|
0
|
0
|
0
|
sub offset { $_[0]->[3] = $_[1] if @_ >= 2; $_[0]->[3] } |
|
0
|
|
|
|
|
0
|
|
26
|
628
|
100
|
|
628
|
0
|
1587
|
sub doc { $_[0]->[4] = $_[1] if @_ >= 2; $_[0]->[4] } |
|
628
|
|
|
|
|
2251
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub as_string { |
29
|
45
|
|
|
45
|
0
|
182
|
my $self = shift; |
30
|
45
|
50
|
|
|
|
306
|
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
|
|
|
|
|
182
|
return $self->type .' error - '. $self->info; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
###----------------------------------------------------------------### |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |