/usr/share/perl5/Mail/SPF/Exception.pm is in libmail-spf-perl 2.9.0-2.
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | #
# Mail::SPF::Exception
# Mail::SPF exception classes.
#
# (C) 2006 Julian Mehnle <julian@mehnle.net>
# $Id: Exception.pm 36 2006-12-09 19:01:46Z Julian Mehnle $
#
##############################################################################
package Mail::SPF::Exception;
use warnings;
use strict;
use base 'Error', 'Mail::SPF::Base';
use constant TRUE => (0 == 0);
use constant FALSE => not TRUE;
sub new {
my ($self, $text) = @_;
local $Error::Depth = $Error::Depth + 1;
return $self->SUPER::new(
defined($text) ? (-text => $text) : ()
);
}
sub stringify {
my ($self) = @_;
my $text = $self->SUPER::stringify;
$text .= sprintf(" (%s) at %s line %d.\n", $self->name, $self->file, $self->line)
if $text !~ /\n$/s;
return $text;
}
sub name {
my ($self) = @_;
my $class = ref($self) || $self;
return $class =~ /^Mail::SPF::(\w+)$/ ? $1 : $class;
}
# Generic Exceptions
##############################################################################
# Tried to call a class method as an instance method:
package Mail::SPF::EClassMethod;
our @ISA = qw(Mail::SPF::Exception);
sub new {
my ($self) = @_;
local $Error::Depth = $Error::Depth + 2;
return $self->SUPER::new(
sprintf('Pure class method %s called as an instance method', (caller($Error::Depth - 1))[3])
);
}
# Tried to call an instance method as a class method:
package Mail::SPF::EInstanceMethod;
our @ISA = qw(Mail::SPF::Exception);
sub new {
my ($self) = @_;
local $Error::Depth = $Error::Depth + 2;
return $self->SUPER::new(
sprintf('Pure instance method %s called as a class method', (caller($Error::Depth - 1))[3])
);
}
# Abstract class cannot be instantiated:
package Mail::SPF::EAbstractClass;
our @ISA = qw(Mail::SPF::Exception);
sub new {
my ($self) = @_;
local $Error::Depth = $Error::Depth + 2;
return $self->SUPER::new('Abstract class cannot be instantiated');
}
# Missing required method option:
package Mail::SPF::EOptionRequired;
our @ISA = qw(Mail::SPF::Exception);
# Invalid value for method option:
package Mail::SPF::EInvalidOptionValue;
our @ISA = qw(Mail::SPF::Exception);
# Read-only value:
package Mail::SPF::EReadOnlyValue;
our @ISA = qw(Mail::SPF::Exception);
# Miscellaneous Errors
##############################################################################
# DNS error:
package Mail::SPF::EDNSError;
our @ISA = qw(Mail::SPF::Exception);
# DNS timeout:
package Mail::SPF::EDNSTimeout;
our @ISA = qw(Mail::SPF::EDNSError);
# Record selection error:
package Mail::SPF::ERecordSelectionError;
our @ISA = qw(Mail::SPF::Exception);
# No acceptable record found:
package Mail::SPF::ENoAcceptableRecord;
our @ISA = qw(Mail::SPF::ERecordSelectionError);
# Redundant acceptable records found:
package Mail::SPF::ERedundantAcceptableRecords;
our @ISA = qw(Mail::SPF::ERecordSelectionError);
# No unparsed text available:
package Mail::SPF::ENoUnparsedText;
our @ISA = qw(Mail::SPF::Exception);
# Unexpected term object encountered:
package Mail::SPF::EUnexpectedTermObject;
our @ISA = qw(Mail::SPF::Exception);
# Processing limit exceeded:
package Mail::SPF::EProcessingLimitExceeded;
our @ISA = qw(Mail::SPF::Exception);
# Missing required context for macro expansion:
package Mail::SPF::EMacroExpansionCtxRequired;
our @ISA = qw(Mail::SPF::EOptionRequired);
# Parser Errors
##############################################################################
# Nothing to parse:
package Mail::SPF::ENothingToParse;
our @ISA = qw(Mail::SPF::Exception);
# Generic syntax error:
package Mail::SPF::ESyntaxError;
our @ISA = qw(Mail::SPF::Exception);
# Invalid record version:
package Mail::SPF::EInvalidRecordVersion;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Invalid scope:
package Mail::SPF::EInvalidScope;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Junk encountered in record:
package Mail::SPF::EJunkInRecord;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Invalid term:
package Mail::SPF::EInvalidTerm;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Junk encountered in term:
package Mail::SPF::EJunkInTerm;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Invalid modifier:
package Mail::SPF::EInvalidMod;
our @ISA = qw(Mail::SPF::EInvalidTerm);
# Duplicate global modifier:
package Mail::SPF::EDuplicateGlobalMod;
our @ISA = qw(Mail::SPF::EInvalidMod);
# Invalid mechanism:
package Mail::SPF::EInvalidMech;
our @ISA = qw(Mail::SPF::EInvalidTerm);
# Invalid mechanism qualifier:
package Mail::SPF::EInvalidMechQualifier;
our @ISA = qw(Mail::SPF::EInvalidMech);
# Missing required <domain-spec> in term:
package Mail::SPF::ETermDomainSpecExpected;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Missing required <ip4-network> in term:
package Mail::SPF::ETermIPv4AddressExpected;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Missing required <ip4-cidr-length> in term:
package Mail::SPF::ETermIPv4PrefixLengthExpected;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Missing required <ip6-network> in term:
package Mail::SPF::ETermIPv6AddressExpected;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Missing required <ip6-cidr-length> in term:
package Mail::SPF::ETermIPv6PrefixLengthExpected;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Invalid macro string:
package Mail::SPF::EInvalidMacroString;
our @ISA = qw(Mail::SPF::ESyntaxError);
# Invalid macro:
package Mail::SPF::EInvalidMacro;
our @ISA = qw(Mail::SPF::EInvalidMacroString);
package Mail::SPF::Exception;
TRUE;
|