line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Mail::SPF::Exception |
3
|
|
|
|
|
|
|
# Mail::SPF exception classes. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# (C) 2006 Julian Mehnle |
6
|
|
|
|
|
|
|
# $Id: Exception.pm 36 2006-12-09 19:01:46Z Julian Mehnle $ |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
############################################################################## |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package Mail::SPF::Exception; |
11
|
|
|
|
|
|
|
|
12
|
7
|
|
|
7
|
|
44
|
use warnings; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
237
|
|
13
|
7
|
|
|
7
|
|
40
|
use strict; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
293
|
|
14
|
|
|
|
|
|
|
|
15
|
7
|
|
|
7
|
|
49
|
use base 'Error', 'Mail::SPF::Base'; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
1123
|
|
16
|
|
|
|
|
|
|
|
17
|
7
|
|
|
7
|
|
43
|
use constant TRUE => (0 == 0); |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
746
|
|
18
|
7
|
|
|
7
|
|
37
|
use constant FALSE => not TRUE; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
9110
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
14
|
|
|
14
|
1
|
291
|
my ($self, $text) = @_; |
22
|
14
|
|
|
|
|
24
|
local $Error::Depth = $Error::Depth + 1; |
23
|
14
|
50
|
|
|
|
117
|
return $self->SUPER::new( |
24
|
|
|
|
|
|
|
defined($text) ? (-text => $text) : () |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub stringify { |
29
|
1
|
|
|
1
|
1
|
160
|
my ($self) = @_; |
30
|
1
|
|
|
|
|
7
|
my $text = $self->SUPER::stringify; |
31
|
1
|
50
|
|
|
|
17
|
$text .= sprintf(" (%s) at %s line %d.\n", $self->name, $self->file, $self->line) |
32
|
|
|
|
|
|
|
if $text !~ /\n$/s; |
33
|
1
|
|
|
|
|
261
|
return $text; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub name { |
37
|
1
|
|
|
1
|
0
|
4
|
my ($self) = @_; |
38
|
1
|
|
33
|
|
|
5
|
my $class = ref($self) || $self; |
39
|
1
|
50
|
|
|
|
15
|
return $class =~ /^Mail::SPF::(\w+)$/ ? $1 : $class; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Generic Exceptions |
44
|
|
|
|
|
|
|
############################################################################## |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Tried to call a class method as an instance method: |
47
|
|
|
|
|
|
|
package Mail::SPF::EClassMethod; |
48
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub new { |
51
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
52
|
0
|
|
|
|
|
|
local $Error::Depth = $Error::Depth + 2; |
53
|
0
|
|
|
|
|
|
return $self->SUPER::new( |
54
|
|
|
|
|
|
|
sprintf('Pure class method %s called as an instance method', (caller($Error::Depth - 1))[3]) |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Tried to call an instance method as a class method: |
59
|
|
|
|
|
|
|
package Mail::SPF::EInstanceMethod; |
60
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub new { |
63
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
64
|
0
|
|
|
|
|
|
local $Error::Depth = $Error::Depth + 2; |
65
|
0
|
|
|
|
|
|
return $self->SUPER::new( |
66
|
|
|
|
|
|
|
sprintf('Pure instance method %s called as a class method', (caller($Error::Depth - 1))[3]) |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Abstract class cannot be instantiated: |
71
|
|
|
|
|
|
|
package Mail::SPF::EAbstractClass; |
72
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub new { |
75
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
76
|
0
|
|
|
|
|
|
local $Error::Depth = $Error::Depth + 2; |
77
|
0
|
|
|
|
|
|
return $self->SUPER::new('Abstract class cannot be instantiated'); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Missing required method option: |
81
|
|
|
|
|
|
|
package Mail::SPF::EOptionRequired; |
82
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Invalid value for method option: |
85
|
|
|
|
|
|
|
package Mail::SPF::EInvalidOptionValue; |
86
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Read-only value: |
89
|
|
|
|
|
|
|
package Mail::SPF::EReadOnlyValue; |
90
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# Miscellaneous Errors |
94
|
|
|
|
|
|
|
############################################################################## |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# DNS error: |
97
|
|
|
|
|
|
|
package Mail::SPF::EDNSError; |
98
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# DNS timeout: |
101
|
|
|
|
|
|
|
package Mail::SPF::EDNSTimeout; |
102
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::EDNSError); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Record selection error: |
105
|
|
|
|
|
|
|
package Mail::SPF::ERecordSelectionError; |
106
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# No acceptable record found: |
109
|
|
|
|
|
|
|
package Mail::SPF::ENoAcceptableRecord; |
110
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ERecordSelectionError); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Redundant acceptable records found: |
113
|
|
|
|
|
|
|
package Mail::SPF::ERedundantAcceptableRecords; |
114
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ERecordSelectionError); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# No unparsed text available: |
117
|
|
|
|
|
|
|
package Mail::SPF::ENoUnparsedText; |
118
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# Unexpected term object encountered: |
121
|
|
|
|
|
|
|
package Mail::SPF::EUnexpectedTermObject; |
122
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# Processing limit exceeded: |
125
|
|
|
|
|
|
|
package Mail::SPF::EProcessingLimitExceeded; |
126
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Missing required context for macro expansion: |
129
|
|
|
|
|
|
|
package Mail::SPF::EMacroExpansionCtxRequired; |
130
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::EOptionRequired); |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# Parser Errors |
134
|
|
|
|
|
|
|
############################################################################## |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# Nothing to parse: |
137
|
|
|
|
|
|
|
package Mail::SPF::ENothingToParse; |
138
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# Generic syntax error: |
141
|
|
|
|
|
|
|
package Mail::SPF::ESyntaxError; |
142
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::Exception); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# Invalid record version: |
145
|
|
|
|
|
|
|
package Mail::SPF::EInvalidRecordVersion; |
146
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
# Invalid scope: |
149
|
|
|
|
|
|
|
package Mail::SPF::EInvalidScope; |
150
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# Junk encountered in record: |
153
|
|
|
|
|
|
|
package Mail::SPF::EJunkInRecord; |
154
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
# Invalid term: |
157
|
|
|
|
|
|
|
package Mail::SPF::EInvalidTerm; |
158
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# Junk encountered in term: |
161
|
|
|
|
|
|
|
package Mail::SPF::EJunkInTerm; |
162
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
# Invalid modifier: |
165
|
|
|
|
|
|
|
package Mail::SPF::EInvalidMod; |
166
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::EInvalidTerm); |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
# Duplicate global modifier: |
169
|
|
|
|
|
|
|
package Mail::SPF::EDuplicateGlobalMod; |
170
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::EInvalidMod); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
# Invalid mechanism: |
173
|
|
|
|
|
|
|
package Mail::SPF::EInvalidMech; |
174
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::EInvalidTerm); |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# Invalid mechanism qualifier: |
177
|
|
|
|
|
|
|
package Mail::SPF::EInvalidMechQualifier; |
178
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::EInvalidMech); |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
# Missing required in term: |
181
|
|
|
|
|
|
|
package Mail::SPF::ETermDomainSpecExpected; |
182
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# Missing required in term: |
185
|
|
|
|
|
|
|
package Mail::SPF::ETermIPv4AddressExpected; |
186
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
# Missing required in term: |
189
|
|
|
|
|
|
|
package Mail::SPF::ETermIPv4PrefixLengthExpected; |
190
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# Missing required in term: |
193
|
|
|
|
|
|
|
package Mail::SPF::ETermIPv6AddressExpected; |
194
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
# Missing required in term: |
197
|
|
|
|
|
|
|
package Mail::SPF::ETermIPv6PrefixLengthExpected; |
198
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
# Invalid macro string: |
201
|
|
|
|
|
|
|
package Mail::SPF::EInvalidMacroString; |
202
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::ESyntaxError); |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
# Invalid macro: |
205
|
|
|
|
|
|
|
package Mail::SPF::EInvalidMacro; |
206
|
|
|
|
|
|
|
our @ISA = qw(Mail::SPF::EInvalidMacroString); |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
package Mail::SPF::Exception; |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
TRUE; |