/usr/share/perl5/Parse/DebControl/Error.pm is in libparse-debcontrol-perl 2.005-4.
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | use strict;
use warnings;
package Parse::DebControl::Error;
=pod
=encoding utf-8
=head1 NAME
Parse::DebControl::Error - Exception classes for Parse::DebControl
=head1 SYNOPSIS
use Parse::DebControl::Error;
throw Parse::DebControl::Error();
throw Parse::DebControl::Error::Parse( "reason for exception" );
throw Parse::DebControl::Error::Parse( "reason for exception", $line_number_of_data );
throw Parse::DebControl::Error::Parse( "reason for exception", $line_number_of_data, $context_line );
throw Parse::DebControl::Error::IO( "information regarding the error" );
=head1 COPYRIGHT
Parse::DebControl is copyright 2003,2004 Jay Bonci E<lt>jaybonci@cpan.orgE<gt>.
Parse::DebControl::Error is copyright 2009 Carl Fürstenberg E<lt>azatoth@gmail.comE<gt>.
This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
=cut
use base 'Error';
our $VERSION = '0.1';
sub new
{
my $self = shift;
local $Error::Depth = $Error::Depth + 1;
$self->SUPER::new(@_);
}
package Parse::DebControl::Error::Parse;
use base 'Parse::DebControl::Error';
our $VERSION = '0.1';
sub new
{
my $self = shift;
my $text = "".shift;
my @args = ();
my $line = shift;
my $context = shift;
push(@args, '-context', $context) if defined($context);
push(@args, '-line', $line) if defined($line);
local $Error::Depth = $Error::Depth + 1;
$self->SUPER::new(-text => $text, @args);
}
sub stringify {
my $self = shift;
my $text;
if( $self->context ) {
$text = sprintf("Parse error: %s at line %d of data (\"%s\").\n", $self->SUPER::stringify, $self->line, $self->context);
} elsif( $self->line ) {
$text = sprintf("Parse error: %s at line %d of data.\n", $self->SUPER::stringify, $self->line);
} else {
$text = sprintf("Parse error: %s.\n", $self->SUPER::stringify);
}
$text;
}
sub context {
my $self = shift;
exists $self->{'-context'} ? $self->{'-context'} : undef;
}
package Parse::DebControl::Error::IO;
use base 'Parse::DebControl::Error';
our $VERSION = '0.1';
sub new
{
my $self = shift;
my $text = "".shift;
my @args = ();
local $Error::Depth = $Error::Depth + 1;
$self->SUPER::new(-text => $text, @args);
}
sub stringify {
my $self = shift;
my $text;
$text = sprintf("IO error: %s.\n", $self->SUPER::stringify );
$text;
}
1;
|