line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rose::HTML::Form::Field::Time::Minutes; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
44
|
use strict; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
224
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
44
|
use Rose::HTML::Object::Errors qw(:time); |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
47
|
|
6
|
6
|
|
|
6
|
|
60
|
use Rose::HTML::Object::Messages qw(:time); |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
37
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
52
|
use base 'Rose::HTML::Form::Field::Text'; |
|
6
|
|
|
|
|
23
|
|
|
6
|
|
|
|
|
1925
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.606'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->add_required_html_attrs( |
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
size => 2, |
15
|
|
|
|
|
|
|
}); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub init |
18
|
|
|
|
|
|
|
{ |
19
|
23
|
|
|
23
|
1
|
70
|
my($self) = shift; |
20
|
23
|
|
|
|
|
118
|
$self->label_id(FIELD_LABEL_MINUTE); |
21
|
23
|
|
|
|
|
164
|
$self->SUPER::init(@_); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub validate |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
0
|
1
|
|
my($self) = shift; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $ok = $self->SUPER::validate(@_); |
29
|
0
|
0
|
|
|
|
|
return $ok unless($ok); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $value = $self->internal_value; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
0
|
|
|
|
unless($value =~ /^\d\d?$/ && $value >= 0 && $value <= 59) |
|
|
|
0
|
|
|
|
|
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
|
|
|
$self->add_error_id(TIME_INVALID_MINUTE); |
36
|
0
|
|
|
|
|
|
return 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return 1; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
if(__PACKAGE__->localizer->auto_load_messages) |
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
__PACKAGE__->localizer->load_all_messages; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
6
|
|
|
6
|
|
50
|
use utf8; # The __DATA__ section contains UTF-8 text |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
37
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__DATA__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
[% LOCALE en %] |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
TIME_INVALID_MINUTE = "Invalid minute." |
56
|
|
|
|
|
|
|
FIELD_LABEL_MINUTE = "Minute" |
57
|
|
|
|
|
|
|
FIELD_ERROR_LABEL_MINUTE = "minute" |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
[% LOCALE de %] |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
TIME_INVALID_MINUTE = "Ungültige Minuten." |
62
|
|
|
|
|
|
|
FIELD_LABEL_MINUTE = "Minuten" |
63
|
|
|
|
|
|
|
FIELD_ERROR_LABEL_MINUTE = "Minuten" |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
[% LOCALE fr %] |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
TIME_INVALID_MINUTE = "Minute invalide." |
68
|
|
|
|
|
|
|
FIELD_LABEL_MINUTE = "Minute" |
69
|
|
|
|
|
|
|
FIELD_ERROR_LABEL_MINUTE = "minute" |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
[% LOCALE bg %] |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
TIME_INVALID_MINUTE = "Невалидна минута." |
74
|
|
|
|
|
|
|
FIELD_LABEL_MINUTE = "Минута" |
75
|
|
|
|
|
|
|
FIELD_ERROR_LABEL_MINUTE = "минута" |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 NAME |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Time::Minutes - Text field that only accepts valid minutes. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SYNOPSIS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$field = |
87
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Time::Minutes->new( |
88
|
|
|
|
|
|
|
label => 'Minutes', |
89
|
|
|
|
|
|
|
name => 'mins'); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
$field->input_value(99); |
92
|
|
|
|
|
|
|
$field->validate; # 0 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$field->input_value(20); |
95
|
|
|
|
|
|
|
$field->validate; # 1 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
print $field->html; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
... |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 DESCRIPTION |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L<Rose::HTML::Form::Field::Time::Minutes> is a subclass of L<Rose::HTML::Form::Field::Text> that only accepts valid minutes: numbers between 0 and 59, inclusive, with or without leading zeros. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
John C. Siracusa (siracusa@gmail.com) |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 LICENSE |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |