File Coverage

blib/lib/SparkX/Form/Field/Textarea.pm
Criterion Covered Total %
statement 9 10 90.0
branch n/a
condition n/a
subroutine 4 5 80.0
pod 2 2 100.0
total 15 17 88.2


line stmt bran cond sub pod time code
1             package SparkX::Form::Field::Textarea;
2             our $VERSION = '0.2102';
3              
4              
5             # ABSTRACT: A Textarea field for SparkX::Form
6              
7 1     1   572 use Moose;
  1         1  
  1         6  
8 1     1   5229 use HTML::Tiny;
  1         2141  
  1         151  
9              
10             extends 'Spark::Form::Field';
11             with 'Spark::Form::Field::Role::Printable::HTML',
12             'Spark::Form::Field::Role::Printable::XHTML';
13              
14             has '+value' => (
15             isa => 'Str',
16             default => q{},
17             );
18              
19             sub to_html {
20 0     0 1 0 return shift->_render(HTML::Tiny->new(mode => 'html'));
21             }
22              
23             sub to_xhtml {
24 1     1 1 12 return shift->_render(HTML::Tiny->new(mode => 'xml'));
25             }
26              
27             sub _render {
28 1     1   49 my ($self, $html) = @_;
29              
30 1         48 return $html->textarea({name => $self->name}, $self->value);
31             }
32             __PACKAGE__->meta->make_immutable;
33             1;
34              
35              
36              
37             =pod
38              
39             =head1 NAME
40              
41             SparkX::Form::Field::Textarea - A Textarea field for SparkX::Form
42              
43             =head1 VERSION
44              
45             version 0.2102
46              
47             =head1 METHODS
48              
49             =head2 to_html() => Str
50              
51             Renders the field to HTML
52              
53             =head2 to_xhtml() => Str
54              
55             Renders the field to XHTML
56              
57             =head2 validate() => Bool
58              
59             Validates the field. Before composition with validators, always returns 1.
60              
61             =head1 SEE ALSO
62              
63             =over 4
64              
65             =item L<SparkX::Form> - The forms module this is to be used with
66              
67             =item L<SparkX::Form::BasicFields> - A collection of fields for use with C<Spark::Form>
68              
69             =back
70              
71              
72              
73             =head1 AUTHOR
74              
75             James Laver L<http://jameslaver.com>
76              
77             =head1 COPYRIGHT AND LICENSE
78              
79             This software is copyright (c) 2009 by James Laver C<< <sprintf qw(%s@%s.%s cpan jameslaver com)> >>.
80              
81             This is free software; you can redistribute it and/or modify it under
82             the same terms as the Perl 5 programming language system itself.
83              
84             =cut
85              
86              
87              
88             __END__
89