Debian Codegraph @

lib/HTML/FormHandler/Widget/Field/Password.pm

raw
1 package HTML::FormHandler::Widget::Field::Password;
2 # ABSTRACT: password rendering widget
3 $HTML::FormHandler::Widget::Field::Password::VERSION = '0.410002';
4 use Moose::Role;
5 use namespace::autoclean;
6 use HTML::FormHandler::Render::Util ('process_attrs');
7
8
9 sub render_element {
10 my $self = shift;
11 my $result = shift || $self->result;
12 my $t;
13
14 my $output = '<input type="password" name="'
15 . $self->html_name . '" id="' . $self->id . '"';
16 $output .= qq{ size="$t"} if $t = $self->size;
17 $output .= qq{ maxlength="$t"} if $t = $self->maxlength;
18 $output .= ' value="' . $self->html_filter($result->fif) . '"';
19 $output .= process_attrs($self->element_attributes($result));
20 $output .= ' />';
21 return $output;
22 }
23
24 sub render {
25 my ( $self, $result ) = @_;
26 $result ||= $self->result;
27 die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result;
28 my $output = $self->render_element( $result );
29 return $self->wrap_field( $result, $output );
30 }
31
32 1;
33
34 __END__
35
36 =pod
37
38 =encoding UTF-8
39
40 =head1 NAME
41
42 HTML::FormHandler::Widget::Field::Password - password rendering widget
43
44 =head1 VERSION
45
46 version 0.410002
47
48 =head1 SYNOPSIS
49
50 Renders a password field
51
52 =head1 AUTHOR
53
54 FormHandler Contributors - see HTML::FormHandler
55
56 =head1 COPYRIGHT AND LICENSE
57
58 This software is copyright (c) 2017 by Gerda Shank.
59
60 This is free software; you can redistribute it and/or modify it under
61 the same terms as the Perl 5 programming language system itself.
62
63 =cut