| 1 | package HTML::FormHandler::Field::PosInteger; | ||
| 2 | # ABSTRACT: positive integer field | ||
| 3 | 3 | $HTML::FormHandler::Field::PosInteger::VERSION = '0.410002'; | |
| 4 | 3 | ▶ | use HTML::FormHandler::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | extends 'HTML::FormHandler::Field::Integer'; | |
| 6 | |||
| 7 | 3 | our $class_messages = { | |
| 8 | 'integer_positive' => 'Value must be a positive integer', | ||
| 9 | }; | ||
| 10 | |||
| 11 | 12 | ▶ | sub get_class_messages { |
|
Subroutine
get_class_messages: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 12 | 12 | my $self = shift; | |
| 13 | return { | ||
| 14 | 12 | %{ $self->next::method }, | |
| 15 | %$class_messages, | ||
| 16 | } | ||
| 17 | } | ||
| 18 | |||
| 19 | apply( | ||
| 20 | [ | ||
| 21 | { | ||
| 22 | 7 | ▶ | check => sub { $_[0] >= 0 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 23 | 4 | ▶ | message => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 24 | 4 | my ( $value, $field ) = @_; | |
| 25 | 4 | return $field->get_message('integer_positive'); | |
| 26 | }, | ||
| 27 | } | ||
| 28 | 3 | ] | |
| 29 | ); | ||
| 30 | |||
| 31 | |||
| 32 | 3 | __PACKAGE__->meta->make_immutable; | |
| 33 | 3 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | 3 | 1; | |
| 35 | |||
| 36 | __END__ | ||