line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Tiny::Error; |
2
|
|
|
|
|
|
|
$Form::Tiny::Error::VERSION = '2.20'; |
3
|
51
|
|
|
51
|
|
772
|
use v5.10; |
|
51
|
|
|
|
|
200
|
|
4
|
51
|
|
|
51
|
|
303
|
use strict; |
|
51
|
|
|
|
|
108
|
|
|
51
|
|
|
|
|
1152
|
|
5
|
51
|
|
|
51
|
|
263
|
use warnings; |
|
51
|
|
|
|
|
143
|
|
|
51
|
|
|
|
|
1541
|
|
6
|
51
|
|
|
51
|
|
21758
|
use Moo; |
|
51
|
|
|
|
|
331308
|
|
|
51
|
|
|
|
|
306
|
|
7
|
51
|
|
|
51
|
|
63598
|
use Types::Standard qw(Maybe Str); |
|
51
|
|
|
|
|
166
|
|
|
51
|
|
|
|
|
341
|
|
8
|
51
|
|
|
51
|
|
82785
|
use Types::TypeTiny qw(StringLike); |
|
51
|
|
|
|
|
130
|
|
|
51
|
|
|
|
|
566
|
|
9
|
51
|
|
|
51
|
|
158579
|
use Carp qw(confess); |
|
51
|
|
|
|
|
127
|
|
|
51
|
|
|
|
|
2855
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use overload |
12
|
51
|
|
|
|
|
396
|
q{""} => 'as_string', |
13
|
51
|
|
|
51
|
|
372
|
fallback => 1; |
|
51
|
|
|
|
|
115
|
|
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
|
2098
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
50
|
|
|
9
|
my $field = $self->field // 'general'; |
40
|
1
|
|
|
|
|
18
|
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.20'; |
50
|
51
|
|
|
51
|
|
33994
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
15040
|
|
|
51
|
|
|
|
|
830
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
package Form::Tiny::Error::InvalidFormat; |
57
|
|
|
|
|
|
|
$Form::Tiny::Error::InvalidFormat::VERSION = '2.20'; |
58
|
51
|
|
|
51
|
|
4452
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
118
|
|
|
51
|
|
|
|
|
199
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub default_error |
61
|
|
|
|
|
|
|
{ |
62
|
8
|
|
|
8
|
|
4136
|
return 'input data format is invalid'; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
package Form::Tiny::Error::Required; |
69
|
|
|
|
|
|
|
$Form::Tiny::Error::Required::VERSION = '2.20'; |
70
|
51
|
|
|
51
|
|
4134
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
117
|
|
|
51
|
|
|
|
|
189
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub default_error |
73
|
|
|
|
|
|
|
{ |
74
|
21
|
|
|
21
|
|
7269
|
return 'field is required'; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
{ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
package Form::Tiny::Error::IsntStrict; |
81
|
|
|
|
|
|
|
$Form::Tiny::Error::IsntStrict::VERSION = '2.20'; |
82
|
51
|
|
|
51
|
|
3773
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
129
|
|
|
51
|
|
|
|
|
199
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub default_error |
85
|
|
|
|
|
|
|
{ |
86
|
32
|
|
|
32
|
|
13658
|
return 'input data has unexpected fields'; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
{ |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
package Form::Tiny::Error::DoesNotValidate; |
93
|
|
|
|
|
|
|
$Form::Tiny::Error::DoesNotValidate::VERSION = '2.20'; |
94
|
51
|
|
|
51
|
|
4641
|
use parent -norequire, 'Form::Tiny::Error'; |
|
51
|
|
|
|
|
106
|
|
|
51
|
|
|
|
|
240
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub default_error |
97
|
|
|
|
|
|
|
{ |
98
|
0
|
|
|
0
|
|
|
return 'data validation failed'; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |