line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormHandler::Widget::Form::Role::HTMLAttributes; |
2
|
|
|
|
|
|
|
# ABSTRACT: set HTML attributes on the form tag |
3
|
|
|
|
|
|
|
$HTML::FormHandler::Widget::Form::Role::HTMLAttributes::VERSION = '0.40067'; |
4
|
141
|
|
|
141
|
|
76851
|
use Moose::Role; |
|
141
|
|
|
|
|
249
|
|
|
141
|
|
|
|
|
867
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub html_form_tag { |
7
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
|
|
|
my @attr_accessors = ( |
10
|
|
|
|
|
|
|
[ action => 'action' ], |
11
|
|
|
|
|
|
|
[ id => 'name' ], |
12
|
|
|
|
|
|
|
[ method => 'http_method' ], |
13
|
|
|
|
|
|
|
[ enctype => 'enctype' ], |
14
|
|
|
|
|
|
|
[ style => 'style' ], |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# make the element_attr a safe default |
18
|
0
|
|
|
|
|
|
my $element_attr = {}; |
19
|
|
|
|
|
|
|
# Assuming that self is a form |
20
|
0
|
0
|
|
|
|
|
$element_attr = { %{$self->form_element_attr} } if ( $self->can( 'form_element_attr' ) ); |
|
0
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Assuming that self is a field |
22
|
0
|
0
|
|
|
|
|
$element_attr = { %{$self->element_attr} } if ( $self->can( 'element_attr' ) ); |
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
foreach my $attr_pair (@attr_accessors) { |
25
|
0
|
|
|
|
|
|
my $attr = $attr_pair->[0]; |
26
|
0
|
|
|
|
|
|
my $accessor = $attr_pair->[1]; |
27
|
0
|
0
|
0
|
|
|
|
if ( !exists $element_attr->{$attr} && defined( my $value = $self->$accessor ) ) { |
28
|
0
|
|
|
|
|
|
$element_attr->{$attr} = $self->$accessor; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $output = '<form'; |
33
|
0
|
|
|
|
|
|
foreach my $attr ( sort keys %$element_attr ) { |
34
|
0
|
|
|
|
|
|
$output .= qq{ $attr="} . $element_attr->{$attr} . qq{"}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$output .= " >\n"; |
38
|
0
|
|
|
|
|
|
return $output; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
141
|
|
|
141
|
|
504306
|
no Moose::Role; |
|
141
|
|
|
|
|
260
|
|
|
141
|
|
|
|
|
688
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=encoding UTF-8 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
HTML::FormHandler::Widget::Form::Role::HTMLAttributes - set HTML attributes on the form tag |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
version 0.40067 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
FormHandler Contributors - see HTML::FormHandler |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Gerda Shank. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
67
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |