lib/HTML/FormFu/Element/Textarea.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 34 / 34 SCAR 6.9
CC
2
Cov
100%
_string_field
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« lib/HTML/FormFu/Element/Fieldset.pm ↑ Summary lib/HTML/FormFu/Model.pm »
1 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Element::Textarea;
4 7 $HTML::FormFu::Element::Textarea::VERSION = '2.06';
5 # ABSTRACT: Textarea form field
6  
7 7 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 7 extends "HTML::FormFu::Element";
10  
11 7 with 'HTML::FormFu::Role::Element::Field',
12 'HTML::FormFu::Role::Element::SingleValueField';
13  
14 7 ▶use HTML::FormFu::Util qw( process_attrs );
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 7 __PACKAGE__->mk_attr_accessors( qw(
17 autocomplete
18 cols
19 maxlength
20 rows
21 placeholder
22 ) );
23  
24 after BUILD => sub {
25 9 ▶ my $self = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
26  
27 9 $self->layout_field_filename('field_layout_textarea_field');
28 9 $self->cols(40);
29 9 $self->rows(20);
30  
31 9 return;
32 7 };
33  
34 sub _string_field {
35 12 ▶ my ( $self, $render ) = @_;
Subroutine _string_field: called CC=2 SCAR=6.9
36  
37 # textarea_tag template
38  
39 my $html = sprintf qq{<textarea name="%s"%s>},
40 $render->{nested_name},
41 12 process_attrs( $render->{attributes} ),
42 ;
43  
44 12 ▶ if ( defined $render->{value} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $render->{"value"}) 7 5 12
45 7 $html .= $render->{value};
46 }
47  
48 12 $html .= "</textarea>";
49  
50 12 return $html;
51 }
52  
53 7 __PACKAGE__->meta->make_immutable;
54  
55 7 1;
56  
57 __END__
58  
59 =pod
60  
61 =encoding UTF-8
62  
63 =head1 NAME
64  
65 HTML::FormFu::Element::Textarea - Textarea form field
66  
67 =head1 VERSION
68  
69 version 2.06
70  
71 =head1 SYNOPSIS
72  
73 my $element = $form->element( Textarea => 'foo' );
74  
75 =head1 DESCRIPTION
76  
77 Textarea form field.
78  
79 =head1 ATTRIBUTE ACCESSORS
80  
81 Get / set input attributes directly with these methods.
82  
83 Arguments: [$string]
84  
85 Return Value: $string
86  
87 =head2 autocomplete
88  
89 =head2 cols
90  
91 =head2 maxlength
92  
93 =head2 rows
94  
95 =head2 placeholder
96  
97 =head1 SEE ALSO
98  
99 Is a sub-class of, and inherits methods from
100 L<HTML::FormFu::Role::Element::Field>,
101 L<HTML::FormFu::Element>
102  
103 L<HTML::FormFu>
104  
105 =head1 AUTHOR
106  
107 Carl Franks, C<cfranks@cpan.org>
108  
109 =head1 LICENSE
110  
111 This library is free software, you can redistribute it and/or modify it under
112 the same terms as Perl itself.
113  
114 =head1 AUTHOR
115  
116 Carl Franks <cpan@fireartist.com>
117  
118 =head1 COPYRIGHT AND LICENSE
119  
120 This software is copyright (c) 2018 by Carl Franks.
121  
122 This is free software; you can redistribute it and/or modify it under
123 the same terms as the Perl 5 programming language system itself.
124  
125 =cut
« lib/HTML/FormFu/Element/Fieldset.pm ↑ Summary lib/HTML/FormFu/Model.pm »