| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::FormHandler::Field::PosInteger; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: positive integer field |
|
3
|
|
|
|
|
|
|
$HTML::FormHandler::Field::PosInteger::VERSION = '0.40067'; |
|
4
|
3
|
|
|
3
|
|
2540
|
use HTML::FormHandler::Moose; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
24
|
|
|
5
|
|
|
|
|
|
|
extends 'HTML::FormHandler::Field::Integer'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $class_messages = { |
|
8
|
|
|
|
|
|
|
'integer_positive' => 'Value must be a positive integer', |
|
9
|
|
|
|
|
|
|
}; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub get_class_messages { |
|
12
|
12
|
|
|
12
|
0
|
14
|
my $self = shift; |
|
13
|
|
|
|
|
|
|
return { |
|
14
|
12
|
|
|
|
|
10
|
%{ $self->next::method }, |
|
|
12
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
|
|
%$class_messages, |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
apply( |
|
20
|
|
|
|
|
|
|
[ |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
|
|
|
|
|
|
check => sub { $_[0] >= 0 }, |
|
23
|
|
|
|
|
|
|
message => sub { |
|
24
|
|
|
|
|
|
|
my ( $value, $field ) = @_; |
|
25
|
|
|
|
|
|
|
return $field->get_message('integer_positive'); |
|
26
|
|
|
|
|
|
|
}, |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
] |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
33
|
3
|
|
|
3
|
|
5128
|
use namespace::autoclean; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
31
|
|
|
34
|
|
|
|
|
|
|
1; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=pod |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=encoding UTF-8 |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
HTML::FormHandler::Field::PosInteger - positive integer field |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 VERSION |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
version 0.40067 |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Tests that the input is an integer and has a positive value. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Customize error message 'integer_positive'. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
FormHandler Contributors - see HTML::FormHandler |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Gerda Shank. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
65
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |