line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Tiny::Error; |
2
|
|
|
|
|
|
|
$Form::Tiny::Error::VERSION = '2.21'; |
3
|
52
|
|
|
52
|
|
788
|
use v5.10; |
|
52
|
|
|
|
|
189
|
|
4
|
52
|
|
|
52
|
|
292
|
use strict; |
|
52
|
|
|
|
|
134
|
|
|
52
|
|
|
|
|
1162
|
|
5
|
52
|
|
|
52
|
|
244
|
use warnings; |
|
52
|
|
|
|
|
103
|
|
|
52
|
|
|
|
|
1504
|
|
6
|
52
|
|
|
52
|
|
21467
|
use Moo; |
|
52
|
|
|
|
|
327640
|
|
|
52
|
|
|
|
|
305
|
|
7
|
52
|
|
|
52
|
|
62821
|
use Types::Standard qw(Maybe Str); |
|
52
|
|
|
|
|
153
|
|
|
52
|
|
|
|
|
334
|
|
8
|
52
|
|
|
52
|
|
82679
|
use Types::TypeTiny qw(StringLike); |
|
52
|
|
|
|
|
126
|
|
|
52
|
|
|
|
|
515
|
|
9
|
52
|
|
|
52
|
|
156497
|
use Carp qw(confess); |
|
52
|
|
|
|
|
129
|
|
|
52
|
|
|
|
|
2803
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use overload |
12
|
52
|
|
|
|
|
384
|
q{""} => 'as_string', |
13
|
52
|
|
|
52
|
|
333
|
fallback => 1; |
|
52
|
|
|
|
|
121
|
|
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
|
2280
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
50
|
|
|
8
|
my $field = $self->field // 'general'; |
40
|
1
|
|
|
|
|
4
|
my $error = $self->error; |
41
|
1
|
|
|
|
|
8
|
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.21'; |
50
|
52
|
|
|
52
|
|
32798
|
use parent -norequire, 'Form::Tiny::Error'; |
|
52
|
|
|
|
|
14819
|
|
|
52
|
|
|
|
|
823
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
package Form::Tiny::Error::InvalidFormat; |
57
|
|
|
|
|
|
|
$Form::Tiny::Error::InvalidFormat::VERSION = '2.21'; |
58
|
52
|
|
|
52
|
|
4324
|
use parent -norequire, 'Form::Tiny::Error'; |
|
52
|
|
|
|
|
125
|
|
|
52
|
|
|
|
|
195
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub default_error |
61
|
|
|
|
|
|
|
{ |
62
|
8
|
|
|
8
|
|
3992
|
return 'input data format is invalid'; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
package Form::Tiny::Error::Required; |
69
|
|
|
|
|
|
|
$Form::Tiny::Error::Required::VERSION = '2.21'; |
70
|
52
|
|
|
52
|
|
4208
|
use parent -norequire, 'Form::Tiny::Error'; |
|
52
|
|
|
|
|
115
|
|
|
52
|
|
|
|
|
504
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub default_error |
73
|
|
|
|
|
|
|
{ |
74
|
21
|
|
|
21
|
|
6693
|
return 'field is required'; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
{ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
package Form::Tiny::Error::IsntStrict; |
81
|
|
|
|
|
|
|
$Form::Tiny::Error::IsntStrict::VERSION = '2.21'; |
82
|
52
|
|
|
52
|
|
3773
|
use parent -norequire, 'Form::Tiny::Error'; |
|
52
|
|
|
|
|
169
|
|
|
52
|
|
|
|
|
184
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub default_error |
85
|
|
|
|
|
|
|
{ |
86
|
32
|
|
|
32
|
|
13344
|
return 'input data has unexpected fields'; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
{ |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
package Form::Tiny::Error::DoesNotValidate; |
93
|
|
|
|
|
|
|
$Form::Tiny::Error::DoesNotValidate::VERSION = '2.21'; |
94
|
52
|
|
|
52
|
|
4685
|
use parent -norequire, 'Form::Tiny::Error'; |
|
52
|
|
|
|
|
116
|
|
|
52
|
|
|
|
|
210
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub default_error |
97
|
|
|
|
|
|
|
{ |
98
|
0
|
|
|
0
|
|
|
return 'data validation failed'; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |