/usr/share/perl5/Template/Alloy/Exception.pm is in libtemplate-alloy-perl 1.020-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | package Template::Alloy::Exception;
=head1 NAME
Template::Alloy::Exception - Handle exceptions
=cut
use strict;
use warnings;
use overload
'""' => \&as_string,
bool => sub { defined shift },
fallback => 1;
sub new {
my ($class, $type, $info, $node, $pos, $doc) = @_;
return bless [$type, $info, $node, $pos, $doc], $class;
}
sub type { $_[0]->[0] }
sub info { $_[0]->[1] = $_[1] if @_ >= 2; $_[0]->[1] }
sub node { $_[0]->[2] = $_[1] if @_ >= 2; $_[0]->[2] }
sub offset { $_[0]->[3] = $_[1] if @_ >= 2; $_[0]->[3] }
sub doc { $_[0]->[4] = $_[1] if @_ >= 2; $_[0]->[4] }
sub as_string {
my $self = shift;
if ($self->type =~ /^parse/) {
if (my $doc = $self->doc) {
my ($line, $char) = Template::Alloy->get_line_number_by_index($doc, $self->offset, 'include_char');
return $self->type ." error - $doc->{'name'} line $line char $char: ". $self->info;
} else {
return $self->type .' error - '. $self->info .' (At char '. $self->offset .')';
}
} else {
return $self->type .' error - '. $self->info;
}
}
###----------------------------------------------------------------###
1;
__END__
=head1 DESCRIPTION
Template::Alloy::Exception provides compatibility with Template::Exception
and filters that require Template::Exception.
=head1 TODO
Document all of the methods.
=head1 AUTHOR
Paul Seamons <paul@seamons.com>
=head1 LICENSE
This module may be distributed under the same terms as Perl itself.
=cut
|