| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SyForm::FormHTML; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
7
|
|
|
7
|
|
66984
|
$SyForm::FormHTML::AUTHORITY = 'cpan:GETTY'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
# ABSTRACT: HTML Form |
|
6
|
|
|
|
|
|
|
$SyForm::FormHTML::VERSION = '0.103'; |
|
7
|
7
|
|
|
7
|
|
573
|
use Moo; |
|
|
7
|
|
|
|
|
10997
|
|
|
|
7
|
|
|
|
|
45
|
|
|
8
|
7
|
|
|
7
|
|
6343
|
use HTML::Declare ':all'; |
|
|
7
|
|
|
|
|
57777
|
|
|
|
7
|
|
|
|
|
3029
|
|
|
9
|
7
|
|
|
7
|
|
4170
|
use List::MoreUtils qw( uniq ); |
|
|
7
|
|
|
|
|
97212
|
|
|
|
7
|
|
|
|
|
68
|
|
|
10
|
7
|
|
|
7
|
|
10341
|
use Safe::Isa; |
|
|
7
|
|
|
|
|
2936
|
|
|
|
7
|
|
|
|
|
841
|
|
|
11
|
7
|
|
|
7
|
|
3180
|
use SyForm::ViewField::InputHTML; |
|
|
7
|
|
|
|
|
26
|
|
|
|
7
|
|
|
|
|
4492
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with qw( |
|
14
|
|
|
|
|
|
|
MooX::Traits |
|
15
|
|
|
|
|
|
|
SyForm::CommonRole::GlobalHTML |
|
16
|
|
|
|
|
|
|
SyForm::CommonRole::EventHTML |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @attributes = qw( |
|
20
|
|
|
|
|
|
|
action |
|
21
|
|
|
|
|
|
|
autocomplete |
|
22
|
|
|
|
|
|
|
enctype |
|
23
|
|
|
|
|
|
|
method |
|
24
|
|
|
|
|
|
|
target |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
for my $attribute (@attributes) { |
|
28
|
|
|
|
|
|
|
has $attribute => ( |
|
29
|
|
|
|
|
|
|
is => 'ro', |
|
30
|
|
|
|
|
|
|
predicate => 1, |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my @remote_attributes = uniq( |
|
35
|
|
|
|
|
|
|
@SyForm::CommonRole::EventHTML::attributes, |
|
36
|
|
|
|
|
|
|
@SyForm::CommonRole::GlobalHTML::attributes, |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has submit_attributes => ( |
|
40
|
|
|
|
|
|
|
is => 'lazy', |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _build_submit_attributes { |
|
44
|
5
|
|
|
5
|
|
44
|
my ( $self ) = @_; |
|
45
|
5
|
|
|
|
|
87
|
return {}; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has no_submit => ( |
|
49
|
|
|
|
|
|
|
is => 'lazy', |
|
50
|
|
|
|
|
|
|
); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _build_no_submit { |
|
53
|
3
|
|
|
3
|
|
31
|
my ( $self ) = @_; |
|
54
|
3
|
|
|
|
|
55
|
return 0; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has submit => ( |
|
58
|
|
|
|
|
|
|
is => 'lazy', |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _build_submit { |
|
62
|
6
|
|
|
6
|
|
363
|
my ( $self ) = @_; |
|
63
|
|
|
|
|
|
|
return SyForm::ViewField::InputHTML->new( |
|
64
|
|
|
|
|
|
|
type => 'submit', |
|
65
|
6
|
|
|
|
|
12
|
%{$self->submit_attributes}, |
|
|
6
|
|
|
|
|
91
|
|
|
66
|
|
|
|
|
|
|
); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
has children => ( |
|
70
|
|
|
|
|
|
|
is => 'ro', |
|
71
|
|
|
|
|
|
|
predicate => 1, |
|
72
|
|
|
|
|
|
|
); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
has html_attributes => ( |
|
75
|
|
|
|
|
|
|
is => 'lazy', |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _build_html_attributes { |
|
79
|
7
|
|
|
7
|
|
69
|
my ( $self ) = @_; |
|
80
|
7
|
|
|
|
|
13
|
my %html_attributes = %{$self->data_attributes}; |
|
|
7
|
|
|
|
|
113
|
|
|
81
|
7
|
|
|
|
|
25
|
for my $key (@remote_attributes, @attributes) { |
|
82
|
630
|
|
|
|
|
847
|
my $has = 'has_'.$key; |
|
83
|
630
|
100
|
|
|
|
1404
|
$html_attributes{$key} = $self->$key if $self->$has; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
7
|
|
|
|
|
139
|
return { %html_attributes }; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
has html_declare => ( |
|
89
|
|
|
|
|
|
|
is => 'lazy', |
|
90
|
|
|
|
|
|
|
); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _build_html_declare { |
|
93
|
7
|
|
|
7
|
|
37121
|
my ( $self ) = @_; |
|
94
|
|
|
|
|
|
|
return FORM { |
|
95
|
7
|
|
|
|
|
126
|
%{$self->html_attributes}, |
|
96
|
|
|
|
|
|
|
_ => [ |
|
97
|
7
|
100
|
|
|
|
19
|
$self->has_children ? ( map { $_->html_declare } @{$self->children} ) : (), |
|
|
26
|
100
|
|
|
|
2860
|
|
|
|
3
|
|
|
|
|
13
|
|
|
98
|
|
|
|
|
|
|
$self->no_submit ? () : ( $self->submit->html_declare ), |
|
99
|
|
|
|
|
|
|
], |
|
100
|
|
|
|
|
|
|
}; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
has html_declare_children => ( |
|
104
|
|
|
|
|
|
|
is => 'lazy', |
|
105
|
|
|
|
|
|
|
); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub _build_html_declare_children { |
|
108
|
0
|
|
|
0
|
|
|
my ( $self ) = @_; |
|
109
|
0
|
|
|
|
|
|
my @children; |
|
110
|
0
|
|
|
|
|
|
for my $child (@{$self->children}) { |
|
|
0
|
|
|
|
|
|
|
|
111
|
0
|
0
|
0
|
|
|
|
if (!ref $child || $child->$_isa('HTML::Declare')) { |
|
112
|
0
|
|
|
|
|
|
push @children, $child; |
|
113
|
|
|
|
|
|
|
} else { |
|
114
|
0
|
|
|
|
|
|
push @children, $child->html_declare; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
} |
|
117
|
0
|
|
|
|
|
|
return; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__END__ |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=pod |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 NAME |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
SyForm::FormHTML - HTML Form |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 VERSION |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
version 0.103 |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudss.us> |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Torsten Raudssus. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
143
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |