line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Tiny::Error; |
2
|
|
|
|
|
|
|
$Form::Tiny::Error::VERSION = '2.19'; |
3
|
51
|
|
|
51
|
|
793
|
use v5.10; |
|
51
|
|
|
|
|
200
|
|
4
|
51
|
|
|
51
|
|
321
|
use strict; |
|
51
|
|
|
|
|
129
|
|
|
51
|
|
|
|
|
1215
|
|
5
|
51
|
|
|
51
|
|
261
|
use warnings; |
|
51
|
|
|
|
|
118
|
|
|
51
|
|
|
|
|
1536
|
|
6
|
51
|
|
|
51
|
|
22519
|
use Moo; |
|
51
|
|
|
|
|
332053
|
|
|
51
|
|
|
|
|
291
|
|
7
|
51
|
|
|
51
|
|
63551
|
use Types::Standard qw(Maybe Str); |
|
51
|
|
|
|
|
133
|
|
|
51
|
|
|
|
|
346
|
|
8
|
51
|
|
|
51
|
|
83822
|
use Types::TypeTiny qw(StringLike); |
|
51
|
|
|
|
|
167
|
|
|
51
|
|
|
|
|
633
|
|
9
|
51
|
|
|
51
|
|
160573
|
use Carp qw(confess); |
|
51
|
|
|
|
|
188
|
|
|
51
|
|
|
|
|
2886
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use overload |
12
|
51
|
|
|
|
|
419
|
q{""} => 'as_string', |
13
|
51
|
|
|
51
|
|
346
|
fallback => 1; |
|
51
|
|
|
|
|
161
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'field' => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
isa => Str, |
18
|
|
|
|
|
|
|
writer => 'set_field', |
19
|
|
|
|
|
|
|
predicate => 'has_field', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'error' => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => StringLike, |
25
|
|
|
|
|
|
|
writer => 'set_error', |
26
|
|
|
|
|
|
|
builder => 'default_error', |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub default_error |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
|
|
0
|
0
|
0
|
confess 'no error message supplied'; |
32
|
0
|
|
|
|
|
0
|
return 'Unknown error'; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub as_string |
36
|
|
|
|
|
|
|
{ |
37
|
1
|
|
|
1
|
0
|
1639
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
50
|
|
|
9
|
my $field = $self->field // 'general'; |
40
|
1
|
|
|
|
|
20
|
my $error = $self->error; |
41
|
1
|
|
|
|
|
7
|
return "$field - $error"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# in-place subclasses |
45
|
|
|
|
|
|
|
{ |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Internal use only |
48
|
|
|
|
|
|
|
package Form::Tiny::Error::NestedFormError; |
49
|
|
|
|
|
|
|
$Form::Tiny::Error::NestedFormError::VERSION = '2.19'; |
50
|
51
|
|
|
51
|
|
33975
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
15136
|
|
|
51
|
|
|
|
|
916
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
package Form::Tiny::Error::InvalidFormat; |
57
|
|
|
|
|
|
|
$Form::Tiny::Error::InvalidFormat::VERSION = '2.19'; |
58
|
51
|
|
|
51
|
|
4363
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
134
|
|
|
51
|
|
|
|
|
202
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub default_error |
61
|
|
|
|
|
|
|
{ |
62
|
8
|
|
|
8
|
|
4259
|
return 'input data format is invalid'; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
package Form::Tiny::Error::Required; |
69
|
|
|
|
|
|
|
$Form::Tiny::Error::Required::VERSION = '2.19'; |
70
|
51
|
|
|
51
|
|
4434
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
130
|
|
|
51
|
|
|
|
|
237
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub default_error |
73
|
|
|
|
|
|
|
{ |
74
|
21
|
|
|
21
|
|
6733
|
return 'field is required'; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
{ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
package Form::Tiny::Error::IsntStrict; |
81
|
|
|
|
|
|
|
$Form::Tiny::Error::IsntStrict::VERSION = '2.19'; |
82
|
51
|
|
|
51
|
|
3842
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
118
|
|
|
51
|
|
|
|
|
221
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub default_error |
85
|
|
|
|
|
|
|
{ |
86
|
32
|
|
|
32
|
|
13633
|
return 'input data has unexpected fields'; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
{ |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
package Form::Tiny::Error::DoesNotValidate; |
93
|
|
|
|
|
|
|
$Form::Tiny::Error::DoesNotValidate::VERSION = '2.19'; |
94
|
51
|
|
|
51
|
|
4659
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
120
|
|
|
51
|
|
|
|
|
217
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub default_error |
97
|
|
|
|
|
|
|
{ |
98
|
0
|
|
|
0
|
|
|
return 'data validation failed'; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |