File Coverage

blib/lib/SparkX/Form/Field/Password.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 17 17 100.0


line stmt bran cond sub pod time code
1             package SparkX::Form::Field::Password;
2             our $VERSION = '0.2102';
3              
4              
5             # ABSTRACT: A Password field for SparkX::Form
6              
7 2     2   1059 use Moose;
  2         3  
  2         14  
8 2     2   9569 use HTML::Tiny;
  2         2089  
  2         281  
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             );
17              
18             sub to_html {
19 2     2 1 97 return shift->_render(HTML::Tiny->new(mode => 'html'));
20             }
21              
22             sub to_xhtml {
23 3     3 1 113 return shift->_render(HTML::Tiny->new(mode => 'xml'));
24             }
25              
26             sub _render {
27 5     5   135 my ($self, $html) = @_;
28              
29 5         149 return $html->input({type => 'password', name => $self->name});
30             }
31              
32             __PACKAGE__->meta->make_immutable;
33             1;
34              
35              
36              
37             =pod
38              
39             =head1 NAME
40              
41             SparkX::Form::Field::Password - A Password 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