| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Venus::Error; |
|
2
|
|
|
|
|
|
|
|
|
3
|
31
|
|
|
31
|
|
619
|
use 5.018; |
|
|
31
|
|
|
|
|
116
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
31
|
|
|
31
|
|
192
|
use strict; |
|
|
31
|
|
|
|
|
76
|
|
|
|
31
|
|
|
|
|
727
|
|
|
6
|
31
|
|
|
31
|
|
163
|
use warnings; |
|
|
31
|
|
|
|
|
61
|
|
|
|
31
|
|
|
|
|
1014
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
31
|
|
|
31
|
|
209
|
use Venus::Class 'attr', 'base', 'with'; |
|
|
31
|
|
|
|
|
70
|
|
|
|
31
|
|
|
|
|
216
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
base 'Venus::Kind::Utility'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Venus::Role::Explainable'; |
|
13
|
|
|
|
|
|
|
with 'Venus::Role::Stashable'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use overload ( |
|
16
|
|
|
|
|
|
|
'""' => 'explain', |
|
17
|
1
|
|
|
1
|
|
6
|
'eq' => sub{$_[0]->render eq "$_[1]"}, |
|
18
|
1
|
|
|
1
|
|
5
|
'ne' => sub{$_[0]->render ne "$_[1]"}, |
|
19
|
1
|
|
|
1
|
|
3
|
'qr' => sub{qr/@{[quotemeta($_[0]->render)]}/}, |
|
|
1
|
|
|
|
|
6
|
|
|
20
|
31
|
|
|
|
|
419
|
'~~' => 'explain', |
|
21
|
|
|
|
|
|
|
fallback => 1, |
|
22
|
31
|
|
|
31
|
|
257
|
); |
|
|
31
|
|
|
|
|
96
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# ATTRIBUTES |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
attr 'name'; |
|
27
|
|
|
|
|
|
|
attr 'context'; |
|
28
|
|
|
|
|
|
|
attr 'message'; |
|
29
|
|
|
|
|
|
|
attr 'verbose'; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# BUILDERS |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub build_arg { |
|
34
|
1
|
|
|
1
|
0
|
3
|
my ($self, $data) = @_; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return { |
|
37
|
1
|
|
|
|
|
5
|
message => $data, |
|
38
|
|
|
|
|
|
|
}; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub build_self { |
|
42
|
182
|
|
|
182
|
0
|
535
|
my ($self, $data) = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
182
|
100
|
|
|
|
715
|
$self->name($data->{name}) if $self->name; |
|
45
|
182
|
100
|
|
|
|
851
|
$self->context('(None)') if !$self->context; |
|
46
|
182
|
100
|
|
|
|
886
|
$self->message('Exception!') if !$self->message; |
|
47
|
182
|
50
|
50
|
|
|
1993
|
$self->verbose($ENV{VENUS_ERROR_VERBOSE} // 1) if !exists $data->{verbose}; |
|
48
|
182
|
50
|
50
|
|
|
483
|
$self->trace($ENV{VENUS_ERROR_TRACE_OFFSET} // 2) if !@{$self->frames}; |
|
|
182
|
|
|
|
|
851
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
182
|
|
|
|
|
530
|
return $self; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# METHODS |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub arguments { |
|
56
|
3
|
|
|
3
|
1
|
13
|
my ($self, $index) = @_; |
|
57
|
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
16
|
my $captured = $self->captured; |
|
59
|
|
|
|
|
|
|
|
|
60
|
3
|
100
|
|
|
|
16
|
return undef if !$captured; |
|
61
|
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
5
|
my $arguments = $captured->{arguments}; |
|
63
|
|
|
|
|
|
|
|
|
64
|
2
|
100
|
|
|
|
10
|
return $arguments if !defined $index; |
|
65
|
|
|
|
|
|
|
|
|
66
|
1
|
50
|
|
|
|
4
|
return undef if !$arguments; |
|
67
|
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
6
|
return $arguments->[$index]; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub as { |
|
73
|
14
|
|
|
14
|
1
|
42
|
my ($self, $name) = @_; |
|
74
|
|
|
|
|
|
|
|
|
75
|
14
|
|
|
|
|
34
|
$name = $self->id($name); |
|
76
|
|
|
|
|
|
|
|
|
77
|
14
|
|
|
|
|
37
|
my $method = "as_${name}"; |
|
78
|
|
|
|
|
|
|
|
|
79
|
14
|
100
|
|
|
|
63
|
$self = ref $self ? $self : $self->new; |
|
80
|
|
|
|
|
|
|
|
|
81
|
14
|
100
|
|
|
|
72
|
if (!$self->can($method)) { |
|
82
|
6
|
|
|
|
|
31
|
return $self->do('name', $name); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
8
|
|
|
|
|
207
|
return $self->$method; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub assertion { |
|
89
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
0
|
my $assert = $self->SUPER::assertion; |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
0
|
$assert->clear->expression('string'); |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
0
|
return $assert; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub callframe { |
|
99
|
3
|
|
|
3
|
1
|
7
|
my ($self, $index) = @_; |
|
100
|
|
|
|
|
|
|
|
|
101
|
3
|
|
|
|
|
9
|
my $captured = $self->captured; |
|
102
|
|
|
|
|
|
|
|
|
103
|
3
|
100
|
|
|
|
15
|
return undef if !$captured; |
|
104
|
|
|
|
|
|
|
|
|
105
|
2
|
|
|
|
|
4
|
my $callframe = $captured->{callframe}; |
|
106
|
|
|
|
|
|
|
|
|
107
|
2
|
100
|
|
|
|
9
|
return $callframe if !defined $index; |
|
108
|
|
|
|
|
|
|
|
|
109
|
1
|
50
|
|
|
|
6
|
return undef if !$callframe; |
|
110
|
|
|
|
|
|
|
|
|
111
|
1
|
|
|
|
|
5
|
return $callframe->[$index]; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub captured { |
|
115
|
7
|
|
|
7
|
1
|
15
|
my ($self) = @_; |
|
116
|
|
|
|
|
|
|
|
|
117
|
7
|
|
|
|
|
20
|
return $self->stash('captured'); |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub id { |
|
121
|
1154
|
|
|
1154
|
0
|
1908
|
my ($self, $name) = @_; |
|
122
|
|
|
|
|
|
|
|
|
123
|
1154
|
100
|
|
|
|
3237
|
$name = lc $name =~ s/\W+/_/gr if $name; |
|
124
|
|
|
|
|
|
|
|
|
125
|
1154
|
|
|
|
|
4863
|
return $name; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub explain { |
|
129
|
714
|
|
|
714
|
1
|
11266
|
my ($self) = @_; |
|
130
|
|
|
|
|
|
|
|
|
131
|
714
|
50
|
|
|
|
1100
|
$self->trace(1, 1) if !@{$self->frames}; |
|
|
714
|
|
|
|
|
1655
|
|
|
132
|
|
|
|
|
|
|
|
|
133
|
714
|
|
|
|
|
1364
|
my $frames = $self->{'$frames'}; |
|
134
|
714
|
|
|
|
|
1704
|
my $message = $self->render; |
|
135
|
|
|
|
|
|
|
|
|
136
|
714
|
|
|
|
|
9377
|
my @stacktrace = "$message" =~ s/^\s+|\s+$//gr; |
|
137
|
|
|
|
|
|
|
|
|
138
|
714
|
50
|
|
|
|
2048
|
return join "\n", @stacktrace, "" if !$self->verbose; |
|
139
|
|
|
|
|
|
|
|
|
140
|
714
|
|
100
|
|
|
1840
|
push @stacktrace, 'Name:', $self->name || '(None)'; |
|
141
|
714
|
|
|
|
|
1858
|
push @stacktrace, 'Type:', ref($self); |
|
142
|
714
|
|
50
|
|
|
2053
|
push @stacktrace, 'Context:', $self->context || '(None)'; |
|
143
|
|
|
|
|
|
|
|
|
144
|
31
|
|
|
31
|
|
27393
|
no warnings 'once'; |
|
|
31
|
|
|
|
|
91
|
|
|
|
31
|
|
|
|
|
7914
|
|
|
145
|
|
|
|
|
|
|
|
|
146
|
714
|
|
|
|
|
3854
|
require Data::Dumper; |
|
147
|
|
|
|
|
|
|
|
|
148
|
714
|
|
|
|
|
1577
|
local $Data::Dumper::Indent = 1; |
|
149
|
714
|
|
|
|
|
1133
|
local $Data::Dumper::Trailingcomma = 0; |
|
150
|
714
|
|
|
|
|
1102
|
local $Data::Dumper::Purity = 0; |
|
151
|
714
|
|
|
|
|
1083
|
local $Data::Dumper::Pad = ''; |
|
152
|
714
|
|
|
|
|
1053
|
local $Data::Dumper::Varname = 'VAR'; |
|
153
|
714
|
|
|
|
|
1050
|
local $Data::Dumper::Useqq = 0; |
|
154
|
714
|
|
|
|
|
967
|
local $Data::Dumper::Terse = 1; |
|
155
|
714
|
|
|
|
|
1046
|
local $Data::Dumper::Freezer = ''; |
|
156
|
714
|
|
|
|
|
1071
|
local $Data::Dumper::Toaster = ''; |
|
157
|
714
|
|
|
|
|
936
|
local $Data::Dumper::Deepcopy = 1; |
|
158
|
714
|
|
|
|
|
1007
|
local $Data::Dumper::Quotekeys = 0; |
|
159
|
714
|
|
|
|
|
1027
|
local $Data::Dumper::Bless = 'bless'; |
|
160
|
714
|
|
|
|
|
985
|
local $Data::Dumper::Pair = ' => '; |
|
161
|
714
|
|
|
|
|
931
|
local $Data::Dumper::Maxdepth = 0; |
|
162
|
714
|
|
|
|
|
973
|
local $Data::Dumper::Maxrecurse = 1000; |
|
163
|
714
|
|
|
|
|
942
|
local $Data::Dumper::Useperl = 0; |
|
164
|
714
|
|
|
|
|
1133
|
local $Data::Dumper::Sortkeys = 1; |
|
165
|
714
|
|
|
|
|
947
|
local $Data::Dumper::Deparse = 1; |
|
166
|
714
|
|
|
|
|
1006
|
local $Data::Dumper::Sparseseen = 0; |
|
167
|
|
|
|
|
|
|
|
|
168
|
714
|
|
|
|
|
1807
|
my $stashed = Data::Dumper->Dump([$self->stash]); |
|
169
|
|
|
|
|
|
|
|
|
170
|
714
|
|
|
|
|
44366
|
$stashed =~ s/^'|'$//g; |
|
171
|
|
|
|
|
|
|
|
|
172
|
714
|
|
|
|
|
1437
|
chomp $stashed; |
|
173
|
|
|
|
|
|
|
|
|
174
|
714
|
|
|
|
|
1653
|
push @stacktrace, 'Stashed:', $stashed; |
|
175
|
714
|
100
|
|
|
|
1921
|
push @stacktrace, 'Traceback (reverse chronological order):' if @$frames > 1; |
|
176
|
|
|
|
|
|
|
|
|
177
|
31
|
|
|
31
|
|
259
|
use warnings 'once'; |
|
|
31
|
|
|
|
|
116
|
|
|
|
31
|
|
|
|
|
30949
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
714
|
|
|
|
|
4432
|
@stacktrace = (join("\n\n", grep defined, @stacktrace), ''); |
|
180
|
|
|
|
|
|
|
|
|
181
|
714
|
|
|
|
|
2111
|
for (my $i = 1; $i < @$frames; $i++) { |
|
182
|
14775
|
|
|
|
|
20799
|
my $pack = $frames->[$i][0]; |
|
183
|
14775
|
|
|
|
|
17949
|
my $file = $frames->[$i][1]; |
|
184
|
14775
|
|
|
|
|
17270
|
my $line = $frames->[$i][2]; |
|
185
|
14775
|
|
|
|
|
17848
|
my $subr = $frames->[$i][3]; |
|
186
|
|
|
|
|
|
|
|
|
187
|
14775
|
|
|
|
|
41000
|
push @stacktrace, "$subr\n in $file at line $line"; |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
714
|
|
|
|
|
9703
|
return join "\n", @stacktrace, ""; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub frames { |
|
194
|
1087
|
|
|
1087
|
1
|
2002
|
my ($self) = @_; |
|
195
|
|
|
|
|
|
|
|
|
196
|
1087
|
|
100
|
|
|
5419
|
return $self->{'$frames'} //= []; |
|
197
|
|
|
|
|
|
|
} |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub is { |
|
200
|
24
|
|
|
24
|
1
|
4714
|
my ($self, $name) = @_; |
|
201
|
|
|
|
|
|
|
|
|
202
|
24
|
|
|
|
|
74
|
$name = $self->id($name); |
|
203
|
|
|
|
|
|
|
|
|
204
|
24
|
|
|
|
|
97
|
my $method = "is_${name}"; |
|
205
|
|
|
|
|
|
|
|
|
206
|
24
|
100
|
66
|
|
|
71
|
if ($self->name && !$self->can($method)) { |
|
207
|
21
|
50
|
|
|
|
103
|
return $self->name eq $name ? true : false; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
|
|
210
|
3
|
50
|
|
|
|
67
|
return (ref $self ? $self: $self->new)->$method ? true : false; |
|
|
|
100
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub name { |
|
214
|
1111
|
|
|
1111
|
1
|
22602
|
my ($self, $name) = @_; |
|
215
|
|
|
|
|
|
|
|
|
216
|
1111
|
|
66
|
|
|
2451
|
return $self->ITEM('name', $self->id($name) // ()); |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
sub of { |
|
220
|
5
|
|
|
5
|
1
|
17
|
my ($self, $name) = @_; |
|
221
|
|
|
|
|
|
|
|
|
222
|
5
|
|
|
|
|
11
|
$name = $self->id($name); |
|
223
|
|
|
|
|
|
|
|
|
224
|
5
|
|
|
|
|
14
|
my $method = "of_${name}"; |
|
225
|
|
|
|
|
|
|
|
|
226
|
5
|
50
|
33
|
|
|
11
|
if ($self->name && !$self->can($method)) { |
|
227
|
5
|
100
|
|
|
|
16
|
return $self->name =~ /$name/ ? true : false; |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
|
|
230
|
0
|
0
|
|
|
|
0
|
return (ref $self ? $self: $self->new)->$method ? true : false; |
|
|
|
0
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
} |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub frame { |
|
234
|
2
|
|
|
2
|
1
|
7
|
my ($self, $index) = @_; |
|
235
|
|
|
|
|
|
|
|
|
236
|
2
|
|
|
|
|
5
|
my $frames = $self->frames; |
|
237
|
|
|
|
|
|
|
|
|
238
|
2
|
|
100
|
|
|
17
|
$index //= 0; |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
return { |
|
241
|
2
|
|
|
|
|
30
|
package => $frames->[$index][0], |
|
242
|
|
|
|
|
|
|
filename => $frames->[$index][1], |
|
243
|
|
|
|
|
|
|
line => $frames->[$index][2], |
|
244
|
|
|
|
|
|
|
subroutine => $frames->[$index][3], |
|
245
|
|
|
|
|
|
|
hasargs => $frames->[$index][4], |
|
246
|
|
|
|
|
|
|
wantarray => $frames->[$index][5], |
|
247
|
|
|
|
|
|
|
evaltext => $frames->[$index][6], |
|
248
|
|
|
|
|
|
|
is_require => $frames->[$index][7], |
|
249
|
|
|
|
|
|
|
hints => $frames->[$index][8], |
|
250
|
|
|
|
|
|
|
bitmask => $frames->[$index][9], |
|
251
|
|
|
|
|
|
|
hinthash => $frames->[$index][10], |
|
252
|
|
|
|
|
|
|
}; |
|
253
|
|
|
|
|
|
|
} |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub render { |
|
256
|
718
|
|
|
718
|
1
|
1167
|
my ($self) = @_; |
|
257
|
|
|
|
|
|
|
|
|
258
|
718
|
|
|
|
|
1880
|
my $message = $self->message; |
|
259
|
718
|
|
|
|
|
2183
|
my $stashed = $self->stash; |
|
260
|
|
|
|
|
|
|
|
|
261
|
718
|
|
|
|
|
2823
|
while (my($key, $value) = each(%$stashed)) { |
|
262
|
719
|
|
|
|
|
1502
|
my $token = quotemeta $key; |
|
263
|
719
|
|
|
|
|
9757
|
$message =~ s/\{\{\s*$token\s*\}\}/$value/g; |
|
264
|
|
|
|
|
|
|
} |
|
265
|
|
|
|
|
|
|
|
|
266
|
718
|
|
|
|
|
1636
|
return $message; |
|
267
|
|
|
|
|
|
|
} |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub throw { |
|
270
|
157
|
|
|
157
|
1
|
489
|
my ($self, @args) = @_; |
|
271
|
|
|
|
|
|
|
|
|
272
|
157
|
100
|
|
|
|
531
|
$self = $self->new(@args) if !ref $self; |
|
273
|
|
|
|
|
|
|
|
|
274
|
157
|
|
|
|
|
1328
|
die $self; |
|
275
|
|
|
|
|
|
|
} |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
sub trace { |
|
278
|
185
|
|
|
185
|
1
|
466
|
my ($self, $offset, $limit) = @_; |
|
279
|
|
|
|
|
|
|
|
|
280
|
185
|
|
|
|
|
504
|
my $frames = $self->frames; |
|
281
|
|
|
|
|
|
|
|
|
282
|
185
|
|
|
|
|
471
|
@$frames = (); |
|
283
|
|
|
|
|
|
|
|
|
284
|
185
|
|
100
|
|
|
1797
|
for (my $i = $offset // 1; my @caller = caller($i); $i++) { |
|
285
|
3844
|
|
|
|
|
11354
|
push @$frames, [@caller]; |
|
286
|
|
|
|
|
|
|
|
|
287
|
3844
|
100
|
100
|
|
|
23549
|
last if defined $limit && $i + 1 == $offset + $limit; |
|
288
|
|
|
|
|
|
|
} |
|
289
|
|
|
|
|
|
|
|
|
290
|
185
|
|
|
|
|
585
|
return $self; |
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
1; |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head1 NAME |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
Venus::Error - Error Class |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=cut |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head1 ABSTRACT |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Error Class for Perl 5 |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=cut |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
package main; |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
use Venus::Error; |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
my $error = Venus::Error->new; |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
# $error->throw; |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
This package represents a context-aware error (exception object). The default |
|
324
|
|
|
|
|
|
|
for error verbosity can be controlled via the C |
|
325
|
|
|
|
|
|
|
environment variable, e.g. a setting of C<0> disables stack traces. The default |
|
326
|
|
|
|
|
|
|
trace-offset can be controlled via the C environment |
|
327
|
|
|
|
|
|
|
variable, e.g. a setting of C<0> indicates no offset. |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=cut |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
This package has the following attributes: |
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=cut |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=head2 name |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
name(Str) |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Str)> values, and is optional. |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=cut |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=head2 context |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
context(Str) |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Str)> values, is optional, and defaults to C<'(None)'>. |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=cut |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=head2 message |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
message(Str) |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Str)> values, is optional, and defaults to C<'Exception!'>. |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=cut |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
=head2 verbose |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
verbose(Int) |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Int)> values, is optional, and defaults to C<1>. |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=cut |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=head1 INHERITS |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
This package inherits behaviors from: |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
L |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=cut |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=head1 INTEGRATES |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
This package integrates behaviors from: |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
L |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
L |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=cut |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=head1 METHODS |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
This package provides the following methods: |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=cut |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=head2 arguments |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
arguments(Int $index) (Any) |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
The arguments method returns the stashed arguments under L, or a |
|
398
|
|
|
|
|
|
|
specific argument if an index is provided. |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
I> |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=over 4 |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=item arguments example 1 |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
# given: synopsis |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
my $arguments = $error->arguments; |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
# undef |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=back |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=over 4 |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=item arguments example 2 |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
package main; |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
use Venus::Throw; |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
my $error = Venus::Throw->new->capture(1..4)->catch('error'); |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
my $arguments = $error->arguments; |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
# [1..4] |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=back |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=over 4 |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=item arguments example 3 |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
package main; |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
use Venus::Throw; |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
my $error = Venus::Throw->new->capture(1..4)->catch('error'); |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
my $arguments = $error->arguments(0); |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
# 1 |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=back |
|
445
|
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
=cut |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=head2 as |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
as(Str $name) (Error) |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
The as method returns an error object using the return value(s) of the "as" |
|
453
|
|
|
|
|
|
|
method specified, which should be defined as C<"as_${name}">, which will be |
|
454
|
|
|
|
|
|
|
called automatically by this method. If no C<"as_${name}"> method exists, this |
|
455
|
|
|
|
|
|
|
method will set the L attribute to the value provided. |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
I> |
|
458
|
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
=over 4 |
|
460
|
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=item as example 1 |
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
package System::Error; |
|
464
|
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
use Venus::Class; |
|
466
|
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
468
|
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
sub as_auth_error { |
|
470
|
|
|
|
|
|
|
my ($self) = @_; |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
return $self->do('message', 'auth_error'); |
|
473
|
|
|
|
|
|
|
} |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
sub as_role_error { |
|
476
|
|
|
|
|
|
|
my ($self) = @_; |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
return $self->do('message', 'role_error'); |
|
479
|
|
|
|
|
|
|
} |
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
sub is_auth_error { |
|
482
|
|
|
|
|
|
|
my ($self) = @_; |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
return $self->message eq 'auth_error'; |
|
485
|
|
|
|
|
|
|
} |
|
486
|
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
sub is_role_error { |
|
488
|
|
|
|
|
|
|
my ($self) = @_; |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
return $self->message eq 'role_error'; |
|
491
|
|
|
|
|
|
|
} |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
package main; |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
my $error = System::Error->new->as('auth_error'); |
|
496
|
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
$error->throw; |
|
498
|
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
# Exception! (isa Venus::Error) |
|
500
|
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=back |
|
502
|
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=over 4 |
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=item as example 2 |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
package System::Error; |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
use Venus::Class; |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
512
|
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
sub as_auth_error { |
|
514
|
|
|
|
|
|
|
my ($self) = @_; |
|
515
|
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
return $self->do('message', 'auth_error'); |
|
517
|
|
|
|
|
|
|
} |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
sub as_role_error { |
|
520
|
|
|
|
|
|
|
my ($self) = @_; |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
return $self->do('message', 'role_error'); |
|
523
|
|
|
|
|
|
|
} |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
sub is_auth_error { |
|
526
|
|
|
|
|
|
|
my ($self) = @_; |
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
return $self->message eq 'auth_error'; |
|
529
|
|
|
|
|
|
|
} |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
sub is_role_error { |
|
532
|
|
|
|
|
|
|
my ($self) = @_; |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
return $self->message eq 'role_error'; |
|
535
|
|
|
|
|
|
|
} |
|
536
|
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
package main; |
|
538
|
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
my $error = System::Error->new->as('role_error'); |
|
540
|
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
$error->throw; |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
# Exception! (isa Venus::Error) |
|
544
|
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
=back |
|
546
|
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
=over 4 |
|
548
|
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
=item as example 3 |
|
550
|
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
package Virtual::Error; |
|
552
|
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
use Venus::Class; |
|
554
|
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
556
|
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
package main; |
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
my $error = Virtual::Error->new->as('on_save_error'); |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
$error->throw; |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
# name is "on_save_error" |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
# Exception! (isa Venus::Error) |
|
566
|
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=back |
|
568
|
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
=over 4 |
|
570
|
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=item as example 4 |
|
572
|
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
package Virtual::Error; |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
use Venus::Class; |
|
576
|
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
package main; |
|
580
|
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
my $error = Virtual::Error->new->as('on.SAVE.error'); |
|
582
|
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
$error->throw; |
|
584
|
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
# name is "on_save_error" |
|
586
|
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
# Exception! (isa Venus::Error) |
|
588
|
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
=back |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
=cut |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
=head2 callframe |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
callframe(Int $index) (Any) |
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
The callframe method returns the stashed callframe under L, or a |
|
598
|
|
|
|
|
|
|
specific argument if an index is provided. |
|
599
|
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
I> |
|
601
|
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
=over 4 |
|
603
|
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
=item callframe example 1 |
|
605
|
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
# given: synopsis |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
my $callframe = $error->callframe; |
|
609
|
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
# undef |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
=back |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=over 4 |
|
615
|
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
=item callframe example 2 |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
package main; |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
use Venus::Throw; |
|
621
|
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
my $error = Venus::Throw->new->do('frame', 0)->capture->catch('error'); |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
my $callframe = $error->callframe; |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
# [...] |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
=back |
|
629
|
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=over 4 |
|
631
|
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
=item callframe example 3 |
|
633
|
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
package main; |
|
635
|
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
use Venus::Throw; |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
my $error = Venus::Throw->new->do('frame', 0)->capture->catch('error'); |
|
639
|
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
my $package = $error->callframe(0); |
|
641
|
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
# 'main' |
|
643
|
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
=back |
|
645
|
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=cut |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=head2 captured |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
captured() (HashRef) |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
The captured method returns the value stashed as C<"captured">. |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
I> |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=over 4 |
|
657
|
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
=item captured example 1 |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
# given: synopsis |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
my $captured = $error->captured; |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
# undef |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
=back |
|
667
|
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
=cut |
|
669
|
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
=head2 explain |
|
671
|
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
explain() (Str) |
|
673
|
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
The explain method returns the error message and is used in stringification |
|
675
|
|
|
|
|
|
|
operations. |
|
676
|
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
I> |
|
678
|
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=over 4 |
|
680
|
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=item explain example 1 |
|
682
|
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
# given: synopsis; |
|
684
|
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
my $explain = $error->explain; |
|
686
|
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
# "Exception! in ... |
|
688
|
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
=back |
|
690
|
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
=cut |
|
692
|
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
=head2 frame |
|
694
|
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
frame(Int $index) (HashRef) |
|
696
|
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
The frame method returns the data from C on the frames captured, and |
|
698
|
|
|
|
|
|
|
returns a hashref where the keys map to the keys described by |
|
699
|
|
|
|
|
|
|
L. |
|
700
|
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
I> |
|
702
|
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
=over 4 |
|
704
|
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
=item frame example 1 |
|
706
|
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
# given: synopsis; |
|
708
|
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
my $frame = $error->frame; |
|
710
|
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
# { |
|
712
|
|
|
|
|
|
|
# 'bitmask' => '...', |
|
713
|
|
|
|
|
|
|
# 'evaltext' => '...', |
|
714
|
|
|
|
|
|
|
# 'filename' => '...', |
|
715
|
|
|
|
|
|
|
# 'hasargs' => '...', |
|
716
|
|
|
|
|
|
|
# 'hinthash' => '...', |
|
717
|
|
|
|
|
|
|
# 'hints' => '...', |
|
718
|
|
|
|
|
|
|
# 'is_require' => '...', |
|
719
|
|
|
|
|
|
|
# 'line' => '...', |
|
720
|
|
|
|
|
|
|
# 'package' => '...', |
|
721
|
|
|
|
|
|
|
# 'subroutine' => '...', |
|
722
|
|
|
|
|
|
|
# 'wantarray' => '...', |
|
723
|
|
|
|
|
|
|
# } |
|
724
|
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
=back |
|
726
|
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
=over 4 |
|
728
|
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
=item frame example 2 |
|
730
|
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
# given: synopsis; |
|
732
|
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
my $frame = $error->frame(1); |
|
734
|
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
# { |
|
736
|
|
|
|
|
|
|
# 'bitmask' => '...', |
|
737
|
|
|
|
|
|
|
# 'evaltext' => '...', |
|
738
|
|
|
|
|
|
|
# 'filename' => '...', |
|
739
|
|
|
|
|
|
|
# 'hasargs' => '...', |
|
740
|
|
|
|
|
|
|
# 'hinthash' => '...', |
|
741
|
|
|
|
|
|
|
# 'hints' => '...', |
|
742
|
|
|
|
|
|
|
# 'is_require' => '...', |
|
743
|
|
|
|
|
|
|
# 'line' => '...', |
|
744
|
|
|
|
|
|
|
# 'package' => '...', |
|
745
|
|
|
|
|
|
|
# 'subroutine' => '...', |
|
746
|
|
|
|
|
|
|
# 'wantarray' => '...', |
|
747
|
|
|
|
|
|
|
# } |
|
748
|
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
=back |
|
750
|
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
=cut |
|
752
|
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
=head2 frames |
|
754
|
|
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
frames() (ArrayRef) |
|
756
|
|
|
|
|
|
|
|
|
757
|
|
|
|
|
|
|
The frames method returns the compiled and stashed stack trace data. |
|
758
|
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
I> |
|
760
|
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
=over 4 |
|
762
|
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
=item frames example 1 |
|
764
|
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
# given: synopsis; |
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
my $frames = $error->frames; |
|
768
|
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
# [ |
|
770
|
|
|
|
|
|
|
# ... |
|
771
|
|
|
|
|
|
|
# [ |
|
772
|
|
|
|
|
|
|
# "main", |
|
773
|
|
|
|
|
|
|
# "t/Venus_Error.t", |
|
774
|
|
|
|
|
|
|
# ... |
|
775
|
|
|
|
|
|
|
# ], |
|
776
|
|
|
|
|
|
|
# ] |
|
777
|
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=back |
|
779
|
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=cut |
|
781
|
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
=head2 is |
|
783
|
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
is(Str $name) (Bool) |
|
785
|
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
The is method returns truthy or falsy based on the return value(s) of the "is" |
|
787
|
|
|
|
|
|
|
method specified, which should be defined as C<"is_${name}">, which will be |
|
788
|
|
|
|
|
|
|
called automatically by this method. If no C<"is_${name}"> method exists, this |
|
789
|
|
|
|
|
|
|
method will check if the L attribute is equal to the value provided. |
|
790
|
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
I> |
|
792
|
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
=over 4 |
|
794
|
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
=item is example 1 |
|
796
|
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
package System::Error; |
|
798
|
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
use Venus::Class; |
|
800
|
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
802
|
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
sub as_auth_error { |
|
804
|
|
|
|
|
|
|
my ($self) = @_; |
|
805
|
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
return $self->do('message', 'auth_error'); |
|
807
|
|
|
|
|
|
|
} |
|
808
|
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
sub as_role_error { |
|
810
|
|
|
|
|
|
|
my ($self) = @_; |
|
811
|
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
return $self->do('message', 'role_error'); |
|
813
|
|
|
|
|
|
|
} |
|
814
|
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
sub is_auth_error { |
|
816
|
|
|
|
|
|
|
my ($self) = @_; |
|
817
|
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
return $self->message eq 'auth_error'; |
|
819
|
|
|
|
|
|
|
} |
|
820
|
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
sub is_role_error { |
|
822
|
|
|
|
|
|
|
my ($self) = @_; |
|
823
|
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
return $self->message eq 'role_error'; |
|
825
|
|
|
|
|
|
|
} |
|
826
|
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
package main; |
|
828
|
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
my $is = System::Error->new->as('auth_error')->is('auth_error'); |
|
830
|
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
# 1 |
|
832
|
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=back |
|
834
|
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
=over 4 |
|
836
|
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
=item is example 2 |
|
838
|
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
package System::Error; |
|
840
|
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
use Venus::Class; |
|
842
|
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
844
|
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
sub as_auth_error { |
|
846
|
|
|
|
|
|
|
my ($self) = @_; |
|
847
|
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
return $self->do('message', 'auth_error'); |
|
849
|
|
|
|
|
|
|
} |
|
850
|
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
sub as_role_error { |
|
852
|
|
|
|
|
|
|
my ($self) = @_; |
|
853
|
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
return $self->do('message', 'role_error'); |
|
855
|
|
|
|
|
|
|
} |
|
856
|
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
sub is_auth_error { |
|
858
|
|
|
|
|
|
|
my ($self) = @_; |
|
859
|
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
return $self->message eq 'auth_error'; |
|
861
|
|
|
|
|
|
|
} |
|
862
|
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
sub is_role_error { |
|
864
|
|
|
|
|
|
|
my ($self) = @_; |
|
865
|
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
return $self->message eq 'role_error'; |
|
867
|
|
|
|
|
|
|
} |
|
868
|
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
package main; |
|
870
|
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
my $is = System::Error->as('auth_error')->is('auth_error'); |
|
872
|
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
# 1 |
|
874
|
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
=back |
|
876
|
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
=over 4 |
|
878
|
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
=item is example 3 |
|
880
|
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
package System::Error; |
|
882
|
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
use Venus::Class; |
|
884
|
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
886
|
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
sub as_auth_error { |
|
888
|
|
|
|
|
|
|
my ($self) = @_; |
|
889
|
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
return $self->do('message', 'auth_error'); |
|
891
|
|
|
|
|
|
|
} |
|
892
|
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
sub as_role_error { |
|
894
|
|
|
|
|
|
|
my ($self) = @_; |
|
895
|
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
return $self->do('message', 'role_error'); |
|
897
|
|
|
|
|
|
|
} |
|
898
|
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
sub is_auth_error { |
|
900
|
|
|
|
|
|
|
my ($self) = @_; |
|
901
|
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
return $self->message eq 'auth_error'; |
|
903
|
|
|
|
|
|
|
} |
|
904
|
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
sub is_role_error { |
|
906
|
|
|
|
|
|
|
my ($self) = @_; |
|
907
|
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
return $self->message eq 'role_error'; |
|
909
|
|
|
|
|
|
|
} |
|
910
|
|
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
package main; |
|
912
|
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
my $is = System::Error->as('auth_error')->is('role_error'); |
|
914
|
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
# 0 |
|
916
|
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
=back |
|
918
|
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
=over 4 |
|
920
|
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
=item is example 4 |
|
922
|
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
package Virtual::Error; |
|
924
|
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
use Venus::Class; |
|
926
|
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
928
|
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
package main; |
|
930
|
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
my $is = Virtual::Error->new->as('on_save_error')->is('on_save_error'); |
|
932
|
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
# 1 |
|
934
|
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
=back |
|
936
|
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
=over 4 |
|
938
|
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
=item is example 5 |
|
940
|
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
package Virtual::Error; |
|
942
|
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
use Venus::Class; |
|
944
|
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
946
|
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
package main; |
|
948
|
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
my $is = Virtual::Error->new->as('on.SAVE.error')->is('on_save_error'); |
|
950
|
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
# 1 |
|
952
|
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
=back |
|
954
|
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
=cut |
|
956
|
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
=head2 of |
|
958
|
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
of(Str $name) (Bool) |
|
960
|
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
The of method returns truthy or falsy based on the return value(s) of the "of" |
|
962
|
|
|
|
|
|
|
method specified, which should be defined as C<"of_${name}">, which will be |
|
963
|
|
|
|
|
|
|
called automatically by this method. If no C<"of_${name}"> method exists, this |
|
964
|
|
|
|
|
|
|
method will check if the L attribute contains the value provided. |
|
965
|
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
I> |
|
967
|
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
=over 4 |
|
969
|
|
|
|
|
|
|
|
|
970
|
|
|
|
|
|
|
=item of example 1 |
|
971
|
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
package System::Error; |
|
973
|
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
use Venus::Class; |
|
975
|
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
977
|
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
sub as_auth_error { |
|
979
|
|
|
|
|
|
|
my ($self) = @_; |
|
980
|
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
return $self->do('name', 'auth_error'); |
|
982
|
|
|
|
|
|
|
} |
|
983
|
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
sub as_role_error { |
|
985
|
|
|
|
|
|
|
my ($self) = @_; |
|
986
|
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
return $self->do('name', 'role_error'); |
|
988
|
|
|
|
|
|
|
} |
|
989
|
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
sub is_auth_error { |
|
991
|
|
|
|
|
|
|
my ($self) = @_; |
|
992
|
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
return $self->name eq 'auth_error'; |
|
994
|
|
|
|
|
|
|
} |
|
995
|
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
sub is_role_error { |
|
997
|
|
|
|
|
|
|
my ($self) = @_; |
|
998
|
|
|
|
|
|
|
|
|
999
|
|
|
|
|
|
|
return $self->name eq 'role_error'; |
|
1000
|
|
|
|
|
|
|
} |
|
1001
|
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
package main; |
|
1003
|
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
my $of = System::Error->as('auth_error')->of('role'); |
|
1005
|
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
# 0 |
|
1007
|
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
=back |
|
1009
|
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
=over 4 |
|
1011
|
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
=item of example 2 |
|
1013
|
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
package System::Error; |
|
1015
|
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
use Venus::Class; |
|
1017
|
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
1019
|
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
sub as_auth_error { |
|
1021
|
|
|
|
|
|
|
my ($self) = @_; |
|
1022
|
|
|
|
|
|
|
|
|
1023
|
|
|
|
|
|
|
return $self->do('name', 'auth_error'); |
|
1024
|
|
|
|
|
|
|
} |
|
1025
|
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
sub as_role_error { |
|
1027
|
|
|
|
|
|
|
my ($self) = @_; |
|
1028
|
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
return $self->do('name', 'role_error'); |
|
1030
|
|
|
|
|
|
|
} |
|
1031
|
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
sub is_auth_error { |
|
1033
|
|
|
|
|
|
|
my ($self) = @_; |
|
1034
|
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
return $self->name eq 'auth_error'; |
|
1036
|
|
|
|
|
|
|
} |
|
1037
|
|
|
|
|
|
|
|
|
1038
|
|
|
|
|
|
|
sub is_role_error { |
|
1039
|
|
|
|
|
|
|
my ($self) = @_; |
|
1040
|
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
return $self->name eq 'role_error'; |
|
1042
|
|
|
|
|
|
|
} |
|
1043
|
|
|
|
|
|
|
|
|
1044
|
|
|
|
|
|
|
package main; |
|
1045
|
|
|
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
my $of = System::Error->as('auth_error')->of('auth'); |
|
1047
|
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
# 1 |
|
1049
|
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
=back |
|
1051
|
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
=over 4 |
|
1053
|
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
=item of example 3 |
|
1055
|
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
package System::Error; |
|
1057
|
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
use Venus::Class; |
|
1059
|
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
1061
|
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
sub as_auth_error { |
|
1063
|
|
|
|
|
|
|
my ($self) = @_; |
|
1064
|
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
return $self->do('name', 'auth_error'); |
|
1066
|
|
|
|
|
|
|
} |
|
1067
|
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
sub as_role_error { |
|
1069
|
|
|
|
|
|
|
my ($self) = @_; |
|
1070
|
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
return $self->do('name', 'role_error'); |
|
1072
|
|
|
|
|
|
|
} |
|
1073
|
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
sub is_auth_error { |
|
1075
|
|
|
|
|
|
|
my ($self) = @_; |
|
1076
|
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
return $self->name eq 'auth_error'; |
|
1078
|
|
|
|
|
|
|
} |
|
1079
|
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
sub is_role_error { |
|
1081
|
|
|
|
|
|
|
my ($self) = @_; |
|
1082
|
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
return $self->name eq 'role_error'; |
|
1084
|
|
|
|
|
|
|
} |
|
1085
|
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
package main; |
|
1087
|
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
my $of = System::Error->as('auth_error')->of('role_error'); |
|
1089
|
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
# 0 |
|
1091
|
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
=back |
|
1093
|
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
=over 4 |
|
1095
|
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
=item of example 4 |
|
1097
|
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
package Virtual::Error; |
|
1099
|
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
use Venus::Class; |
|
1101
|
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
1103
|
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
package main; |
|
1105
|
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
my $of = Virtual::Error->new->as('on_save_error')->of('on.save'); |
|
1107
|
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
# 1 |
|
1109
|
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
=back |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
=over 4 |
|
1113
|
|
|
|
|
|
|
|
|
1114
|
|
|
|
|
|
|
=item of example 5 |
|
1115
|
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
package Virtual::Error; |
|
1117
|
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
use Venus::Class; |
|
1119
|
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
base 'Venus::Error'; |
|
1121
|
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
package main; |
|
1123
|
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
my $of = Virtual::Error->new->as('on.SAVE.error')->of('on.save'); |
|
1125
|
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
# 1 |
|
1127
|
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
=back |
|
1129
|
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
=cut |
|
1131
|
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
=head2 render |
|
1133
|
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
render() (Str) |
|
1135
|
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
The render method replaces tokens in the message with values from the stash and |
|
1137
|
|
|
|
|
|
|
returns the formatted string. The token style and formatting operation is |
|
1138
|
|
|
|
|
|
|
equivalent to the L operation. |
|
1139
|
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
I> |
|
1141
|
|
|
|
|
|
|
|
|
1142
|
|
|
|
|
|
|
=over 4 |
|
1143
|
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
=item render example 1 |
|
1145
|
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
# given: synopsis |
|
1147
|
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
package main; |
|
1149
|
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
$error->message('Signal received: {{signal}}'); |
|
1151
|
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
$error->stash(signal => 'SIGKILL'); |
|
1153
|
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
my $render = $error->render; |
|
1155
|
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
# "Signal received: SIGKILL" |
|
1157
|
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
=back |
|
1159
|
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
=cut |
|
1161
|
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
=head2 throw |
|
1163
|
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
throw(Any @data) (Error) |
|
1165
|
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
The throw method throws an error if the invocant is an object, or creates an |
|
1167
|
|
|
|
|
|
|
error object using the arguments provided and throws the created object. |
|
1168
|
|
|
|
|
|
|
|
|
1169
|
|
|
|
|
|
|
I> |
|
1170
|
|
|
|
|
|
|
|
|
1171
|
|
|
|
|
|
|
=over 4 |
|
1172
|
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
=item throw example 1 |
|
1174
|
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
# given: synopsis; |
|
1176
|
|
|
|
|
|
|
|
|
1177
|
|
|
|
|
|
|
my $throw = $error->throw; |
|
1178
|
|
|
|
|
|
|
|
|
1179
|
|
|
|
|
|
|
# bless({ ... }, 'Venus::Error') |
|
1180
|
|
|
|
|
|
|
|
|
1181
|
|
|
|
|
|
|
=back |
|
1182
|
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
=cut |
|
1184
|
|
|
|
|
|
|
|
|
1185
|
|
|
|
|
|
|
=head2 trace |
|
1186
|
|
|
|
|
|
|
|
|
1187
|
|
|
|
|
|
|
trace(Int $offset, Int $limit) (Error) |
|
1188
|
|
|
|
|
|
|
|
|
1189
|
|
|
|
|
|
|
The trace method compiles a stack trace and returns the object. By default it |
|
1190
|
|
|
|
|
|
|
skips the first frame. |
|
1191
|
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
I> |
|
1193
|
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
=over 4 |
|
1195
|
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
=item trace example 1 |
|
1197
|
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
# given: synopsis; |
|
1199
|
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
my $trace = $error->trace; |
|
1201
|
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
# bless({ ... }, 'Venus::Error') |
|
1203
|
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
=back |
|
1205
|
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
=over 4 |
|
1207
|
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
=item trace example 2 |
|
1209
|
|
|
|
|
|
|
|
|
1210
|
|
|
|
|
|
|
# given: synopsis; |
|
1211
|
|
|
|
|
|
|
|
|
1212
|
|
|
|
|
|
|
my $trace = $error->trace(0, 1); |
|
1213
|
|
|
|
|
|
|
|
|
1214
|
|
|
|
|
|
|
# bless({ ... }, 'Venus::Error') |
|
1215
|
|
|
|
|
|
|
|
|
1216
|
|
|
|
|
|
|
=back |
|
1217
|
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
=over 4 |
|
1219
|
|
|
|
|
|
|
|
|
1220
|
|
|
|
|
|
|
=item trace example 3 |
|
1221
|
|
|
|
|
|
|
|
|
1222
|
|
|
|
|
|
|
# given: synopsis; |
|
1223
|
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
my $trace = $error->trace(0, 2); |
|
1225
|
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
# bless({ ... }, 'Venus::Error') |
|
1227
|
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
=back |
|
1229
|
|
|
|
|
|
|
|
|
1230
|
|
|
|
|
|
|
=cut |
|
1231
|
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
=head1 OPERATORS |
|
1233
|
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
This package overloads the following operators: |
|
1235
|
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
=cut |
|
1237
|
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
=over 4 |
|
1239
|
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
=item operation: C<(eq)> |
|
1241
|
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
This package overloads the C operator. |
|
1243
|
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
B |
|
1245
|
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
# given: synopsis; |
|
1247
|
|
|
|
|
|
|
|
|
1248
|
|
|
|
|
|
|
my $result = $error eq 'Exception!'; |
|
1249
|
|
|
|
|
|
|
|
|
1250
|
|
|
|
|
|
|
# 1 |
|
1251
|
|
|
|
|
|
|
|
|
1252
|
|
|
|
|
|
|
=back |
|
1253
|
|
|
|
|
|
|
|
|
1254
|
|
|
|
|
|
|
=over 4 |
|
1255
|
|
|
|
|
|
|
|
|
1256
|
|
|
|
|
|
|
=item operation: C<(ne)> |
|
1257
|
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
This package overloads the C operator. |
|
1259
|
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
B |
|
1261
|
|
|
|
|
|
|
|
|
1262
|
|
|
|
|
|
|
# given: synopsis; |
|
1263
|
|
|
|
|
|
|
|
|
1264
|
|
|
|
|
|
|
my $result = $error ne 'exception!'; |
|
1265
|
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
# 1 |
|
1267
|
|
|
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
=back |
|
1269
|
|
|
|
|
|
|
|
|
1270
|
|
|
|
|
|
|
=over 4 |
|
1271
|
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
=item operation: C<(qr)> |
|
1273
|
|
|
|
|
|
|
|
|
1274
|
|
|
|
|
|
|
This package overloads the C operator. |
|
1275
|
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
B |
|
1277
|
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
# given: synopsis; |
|
1279
|
|
|
|
|
|
|
|
|
1280
|
|
|
|
|
|
|
my $test = 'Exception!' =~ qr/$error/; |
|
1281
|
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
# 1 |
|
1283
|
|
|
|
|
|
|
|
|
1284
|
|
|
|
|
|
|
=back |
|
1285
|
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
=over 4 |
|
1287
|
|
|
|
|
|
|
|
|
1288
|
|
|
|
|
|
|
=item operation: C<("")> |
|
1289
|
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
This package overloads the C<""> operator. |
|
1291
|
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
B |
|
1293
|
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
# given: synopsis; |
|
1295
|
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
my $result = "$error"; |
|
1297
|
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
# "Exception!" |
|
1299
|
|
|
|
|
|
|
|
|
1300
|
|
|
|
|
|
|
=back |
|
1301
|
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
=over 4 |
|
1303
|
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
=item operation: C<(~~)> |
|
1305
|
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
This package overloads the C<~~> operator. |
|
1307
|
|
|
|
|
|
|
|
|
1308
|
|
|
|
|
|
|
B |
|
1309
|
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
# given: synopsis; |
|
1311
|
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
my $result = $error ~~ 'Exception!'; |
|
1313
|
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
# 1 |
|
1315
|
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
=back |
|
1317
|
|
|
|
|
|
|
|
|
1318
|
|
|
|
|
|
|
=head1 AUTHORS |
|
1319
|
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
Awncorp, C |
|
1321
|
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
=cut |
|
1323
|
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
=head1 LICENSE |
|
1325
|
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
|
1327
|
|
|
|
|
|
|
|
|
1328
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
|
1329
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
|
1330
|
|
|
|
|
|
|
|
|
1331
|
|
|
|
|
|
|
=cut |