line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
6
|
|
|
6
|
|
33
|
|
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
166
|
|
4
|
|
|
|
|
|
|
use Rose::HTML::Object::Errors qw(:time); |
5
|
6
|
|
|
6
|
|
28
|
use Rose::HTML::Object::Messages qw(:time); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
33
|
|
6
|
6
|
|
|
6
|
|
33
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
31
|
|
7
|
|
|
|
|
|
|
use base 'Rose::HTML::Form::Field::Text'; |
8
|
6
|
|
|
6
|
|
35
|
|
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
1628
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.606'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->add_required_html_attrs( |
12
|
|
|
|
|
|
|
{ |
13
|
|
|
|
|
|
|
size => 2, |
14
|
|
|
|
|
|
|
}); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
my($self) = shift; |
18
|
|
|
|
|
|
|
$self->label_id(FIELD_LABEL_SECOND); |
19
|
23
|
|
|
23
|
1
|
57
|
$self->SUPER::init(@_); |
20
|
23
|
|
|
|
|
101
|
} |
21
|
23
|
|
|
|
|
110
|
|
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
my($self) = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $ok = $self->SUPER::validate(@_); |
26
|
0
|
|
|
0
|
1
|
|
return $ok unless($ok); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $value = $self->internal_value; |
29
|
0
|
0
|
|
|
|
|
|
30
|
|
|
|
|
|
|
unless($value =~ /^\d\d?$/ && $value >= 0 && $value <= 59) |
31
|
0
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
$self->add_error_id(TIME_INVALID_SECONDS); |
33
|
0
|
0
|
0
|
|
|
|
return 0; |
|
|
|
0
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return 1; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
if(__PACKAGE__->localizer->auto_load_messages) |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
__PACKAGE__->localizer->load_all_messages; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use utf8; # The __DATA__ section contains UTF-8 text |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
6
|
|
|
6
|
|
54
|
|
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
30
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
[% LOCALE en %] |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
FIELD_LABEL_SECOND = "Second" |
52
|
|
|
|
|
|
|
FIELD_ERROR_LABEL_SECOND = "second" |
53
|
|
|
|
|
|
|
TIME_INVALID_SECONDS = "Invalid seconds." |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
[% LOCALE de %] |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
TIME_INVALID_SECONDS = "Ungültige Sekunden." |
58
|
|
|
|
|
|
|
FIELD_LABEL_SECOND = "Sekunden" |
59
|
|
|
|
|
|
|
FIELD_ERROR_LABEL_SECOND = "Sekunden" |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
[% LOCALE fr %] |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
TIME_INVALID_SECONDS = "Secondes invalides." |
64
|
|
|
|
|
|
|
FIELD_LABEL_SECOND = "Second" |
65
|
|
|
|
|
|
|
FIELD_ERROR_LABEL_SECOND = "Second" |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
[% LOCALE bg %] |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
FIELD_LABEL_SECOND = "Секунда" |
70
|
|
|
|
|
|
|
FIELD_ERROR_LABEL_SECOND = "секунда" |
71
|
|
|
|
|
|
|
TIME_INVALID_SECONDS = "Невалидни секунди." |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Time::Seconds - Text field that only accepts valid seconds. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SYNOPSIS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
$field = |
82
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Time::Seconds->new( |
83
|
|
|
|
|
|
|
label => 'Seconds', |
84
|
|
|
|
|
|
|
name => 'secs'); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$field->input_value(99); |
87
|
|
|
|
|
|
|
$field->validate; # 0 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$field->input_value(20); |
90
|
|
|
|
|
|
|
$field->validate; # 1 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
print $field->html; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
... |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L<Rose::HTML::Form::Field::Time::Seconds> is a subclass of L<Rose::HTML::Form::Field::Text> that only accepts valid seconds: numbers between 0 and 59, inclusive, with or without leading zeros. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
John C. Siracusa (siracusa@gmail.com) |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
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. |