| 1 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 15 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | package HTML::Widget::Plugin::Password; | ||||||||||||||||||||||||||||
| 4 | # ABSTRACT: for SECRET input | ||||||||||||||||||||||||||||
| 5 | 15 | $HTML::Widget::Plugin::Password::VERSION = '0.204'; | |||||||||||||||||||||||||||
| 6 | 15 | ▶ | use parent 'HTML::Widget::Plugin::Input'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | #pod =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 9 | #pod | ||||||||||||||||||||||||||||
| 10 | #pod $widget_factory->password({ | ||||||||||||||||||||||||||||
| 11 | #pod id => 'user_secret', | ||||||||||||||||||||||||||||
| 12 | #pod value => "not visible in html", | ||||||||||||||||||||||||||||
| 13 | #pod }); | ||||||||||||||||||||||||||||
| 14 | #pod | ||||||||||||||||||||||||||||
| 15 | #pod =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 16 | #pod | ||||||||||||||||||||||||||||
| 17 | #pod This plugin provides a widget for password-entry inputs. | ||||||||||||||||||||||||||||
| 18 | #pod | ||||||||||||||||||||||||||||
| 19 | #pod =cut | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 15 | ▶ | use HTML::Element; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #pod =head1 METHODS | ||||||||||||||||||||||||||||
| 24 | #pod | ||||||||||||||||||||||||||||
| 25 | #pod =head2 C< provided_widgets > | ||||||||||||||||||||||||||||
| 26 | #pod | ||||||||||||||||||||||||||||
| 27 | #pod This plugin provides the following widgets: password | ||||||||||||||||||||||||||||
| 28 | #pod | ||||||||||||||||||||||||||||
| 29 | #pod =cut | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 17 | ▶ | sub provided_widgets { [ input => 'password' ] } | ||||||||||||||||||||||||||
|
Subroutine
provided_widgets: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | #pod =head2 C< password > | ||||||||||||||||||||||||||||
| 34 | #pod | ||||||||||||||||||||||||||||
| 35 | #pod This method returns a password-entry widget. | ||||||||||||||||||||||||||||
| 36 | #pod | ||||||||||||||||||||||||||||
| 37 | #pod In addition to the generic L<HTML::Widget::Plugin> attributes, the following | ||||||||||||||||||||||||||||
| 38 | #pod are valid arguments: | ||||||||||||||||||||||||||||
| 39 | #pod | ||||||||||||||||||||||||||||
| 40 | #pod =over | ||||||||||||||||||||||||||||
| 41 | #pod | ||||||||||||||||||||||||||||
| 42 | #pod =item value | ||||||||||||||||||||||||||||
| 43 | #pod | ||||||||||||||||||||||||||||
| 44 | #pod This is the widget's initial value. The value is eaten and displayed as a | ||||||||||||||||||||||||||||
| 45 | #pod series of spaces, if the value is defined. | ||||||||||||||||||||||||||||
| 46 | #pod | ||||||||||||||||||||||||||||
| 47 | #pod =back | ||||||||||||||||||||||||||||
| 48 | #pod | ||||||||||||||||||||||||||||
| 49 | #pod =cut | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | #pod =head2 C< rewrite_arg > | ||||||||||||||||||||||||||||
| 52 | #pod | ||||||||||||||||||||||||||||
| 53 | #pod The password plugin's rewrite_arg replaces any non-empty value with a string of | ||||||||||||||||||||||||||||
| 54 | #pod spaces so that passwords are not inadvertantly sent as plain text. | ||||||||||||||||||||||||||||
| 55 | #pod | ||||||||||||||||||||||||||||
| 56 | #pod =cut | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 3 | ▶ | sub rewrite_arg { | ||||||||||||||||||||||||||
|
Subroutine
rewrite_arg: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 59 | 3 | my ($self, $arg, @rest) = @_; | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 3 | $arg = $self->SUPER::rewrite_arg($arg, @rest); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 3 | $arg->{attr}{type} = "password"; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | $arg->{attr}{value} = q{ } x 8 | ||||||||||||||||||||||||||||
| 66 | 3 | ▶ | if defined $arg->{attr}{value} and length $arg->{attr}{value}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $arg->{"attr"}{"value"} and length $arg->{"attr"}{"value"}
MC/DC100%2/2
defined $arg->{"attr"}{"value"} and length $arg->{"attr"}{"value"}
defined $arg->{"attr"}{"value"}
length $arg->{"attr"}{"value"}
Truth table100%3/3
A and B
A= defined $arg->{"attr"}{"value"}B= length $arg->{"attr"}{"value"}
| |||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 3 | return $arg; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 15 | 1; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | __END__ | ||||||||||||||||||||||||||||