line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Shakan::Fields; |
2
|
22
|
|
|
22
|
|
117
|
use strict; |
|
22
|
|
|
|
|
36
|
|
|
22
|
|
|
|
|
698
|
|
3
|
22
|
|
|
22
|
|
113
|
use warnings; |
|
22
|
|
|
|
|
38
|
|
|
22
|
|
|
|
|
605
|
|
4
|
22
|
|
|
22
|
|
113
|
use parent 'Exporter'; |
|
22
|
|
|
|
|
35
|
|
|
22
|
|
|
|
|
203
|
|
5
|
22
|
|
|
22
|
|
1038
|
use Carp (); |
|
22
|
|
|
|
|
72
|
|
|
22
|
|
|
|
|
9462
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw( |
8
|
|
|
|
|
|
|
TextField |
9
|
|
|
|
|
|
|
EmailField |
10
|
|
|
|
|
|
|
URLField |
11
|
|
|
|
|
|
|
UIntField |
12
|
|
|
|
|
|
|
IntField |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
PasswordField |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
FileField |
17
|
|
|
|
|
|
|
ImageField |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
ChoiceField |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
DateField |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Duplication |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# DateTimeField |
27
|
|
|
|
|
|
|
# ImageField |
28
|
|
|
|
|
|
|
# TimeField |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _input { |
31
|
41
|
|
|
41
|
|
705
|
HTML::Shakan::Field::Input->new( @_ ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub TextField { |
35
|
38
|
|
|
38
|
1
|
57760
|
_input(type => 'text', @_); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub EmailField { |
39
|
2
|
|
|
2
|
1
|
545
|
TextField(@_)->add_constraint('EMAIL_LOOSE'); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub URLField { |
43
|
2
|
|
|
2
|
1
|
536
|
TextField(@_)->add_constraint('HTTP_URL'); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub UIntField { |
47
|
2
|
|
|
2
|
1
|
497
|
TextField(@_)->add_constraint('UINT'); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub IntField { |
51
|
2
|
|
|
2
|
1
|
525
|
TextField(@_)->add_constraint('INT'); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub PasswordField { |
55
|
3
|
|
|
3
|
1
|
9
|
_input(type => 'password', @_); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub FileField { |
59
|
8
|
|
|
8
|
1
|
916807
|
HTML::Shakan::Field::File->new(@_); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub ImageField { |
63
|
3
|
|
|
3
|
1
|
16816
|
FileField(@_)->add_constraint(['FILE_MIME' => qr{image/.+}]); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub ChoiceField { |
67
|
13
|
|
|
13
|
1
|
8918
|
HTML::Shakan::Field::Choice->new( @_ ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub DateField { |
71
|
4
|
|
|
4
|
1
|
9523
|
HTML::Shakan::Field::Date->new( @_ ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub Duplication { |
75
|
2
|
|
|
2
|
1
|
4
|
my ($name, $f1, $f2) = @_; |
76
|
2
|
50
|
|
|
|
7
|
Carp::croak('missing args. Usage: Duplication(name, field1, field2)') unless @_ == 3; |
77
|
2
|
|
|
|
|
20
|
$f1->add_complex_constraint( |
78
|
|
|
|
|
|
|
+{ $name => [ $f1->name(), $f2->name() ] } => [ 'DUPLICATION' ] |
79
|
|
|
|
|
|
|
); |
80
|
2
|
|
|
|
|
20
|
return ($f1, $f2); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
__END__ |