| 1 | =head1 NAME | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | HTML::Tested::Value::PasswordBox - password input. | ||||||||||||||||||||||
| 4 | |||||||||||||||||||||||
| 5 | =head1 DESCRIPTION | ||||||||||||||||||||||
| 6 | |||||||||||||||||||||||
| 7 | Provides <input type="password" /> html tag. | ||||||||||||||||||||||
| 8 | |||||||||||||||||||||||
| 9 | =head1 METHODS | ||||||||||||||||||||||
| 10 | |||||||||||||||||||||||
| 11 | =cut | ||||||||||||||||||||||
| 12 | |||||||||||||||||||||||
| 13 | 1 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 14 | 1 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 15 | |||||||||||||||||||||||
| 16 | package HTML::Tested::Value::PasswordBox; | ||||||||||||||||||||||
| 17 | 1 | ▶ | use base 'HTML::Tested::Value'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 18 | |||||||||||||||||||||||
| 19 | =head2 $class->new($parent, $name, %opts) | ||||||||||||||||||||||
| 20 | |||||||||||||||||||||||
| 21 | Overloads C<HTML::Tested::Value> C<new> function to handle C<check_mismatch> | ||||||||||||||||||||||
| 22 | option. | ||||||||||||||||||||||
| 23 | |||||||||||||||||||||||
| 24 | =cut | ||||||||||||||||||||||
| 25 | 5 | ▶ | sub new { | ||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 26 | 5 | my ($class, $parent, $name, %opts) = @_; | |||||||||||||||||||||
| 27 | 5 | my $other = $opts{check_mismatch}; | |||||||||||||||||||||
| 28 | 1 | ▶ | push @{ $opts{constraints} }, [ mismatch => sub { | ||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||
| 29 | 4 | my ($v, $root) = @_; | |||||||||||||||||||||
| 30 | 4 | ▶ | return ($v // '') eq ($root->$other // ''); | ||||||||||||||||||||
|
Condition100%4/4
$v // ""
$root->$other // ""
MC/DC100%1/1
$v // ""
$v
MC/DC100%1/1
$root->$other // ""
$root->$other
Truth table100%2/2
A
A= $v
Truth table100%2/2
A
A= $root->$other
| |||||||||||||||||||||||
| 31 | 5 | ▶ | } ] if $other; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 32 | 5 | return $class->SUPER::new($parent, $name, %opts); | |||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||
| 34 | |||||||||||||||||||||||
| 35 | 1 | ▶ | sub value_to_string { | ||||||||||||||||||||
|
Subroutine
value_to_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 36 | 1 | my ($self, $name, $val) = @_; | |||||||||||||||||||||
| 37 | 1 | return <<ENDS; | |||||||||||||||||||||
| 38 | <input type="password" name="$name" id="$name" value="$val" /> | ||||||||||||||||||||||
| 39 | ENDS | ||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | 1 | 1; | |||||||||||||||||||||
| 43 | |||||||||||||||||||||||
| 44 | =head1 OPTIONS | ||||||||||||||||||||||
| 45 | |||||||||||||||||||||||
| 46 | =over | ||||||||||||||||||||||
| 47 | |||||||||||||||||||||||
| 48 | =item check_mismatch | ||||||||||||||||||||||
| 49 | |||||||||||||||||||||||
| 50 | Checks mismatch between two passwords during validate phase. The parameter | ||||||||||||||||||||||
| 51 | should be the name of another password box. | ||||||||||||||||||||||
| 52 | |||||||||||||||||||||||
| 53 | E.g. check_mismatch => 'another_password'. | ||||||||||||||||||||||
| 54 | |||||||||||||||||||||||
| 55 | On failure produces C<mismatch> result for validate function. | ||||||||||||||||||||||
| 56 | |||||||||||||||||||||||
| 57 | =back | ||||||||||||||||||||||
| 58 | |||||||||||||||||||||||
| 59 | =head1 AUTHOR | ||||||||||||||||||||||
| 60 | |||||||||||||||||||||||
| 61 | Boris Sukholitko (boriss@gmail.com) | ||||||||||||||||||||||
| 62 | |||||||||||||||||||||||
| 63 | =head1 COPYRIGHT | ||||||||||||||||||||||
| 64 | |||||||||||||||||||||||
| 65 | This program is free software; you can redistribute | ||||||||||||||||||||||
| 66 | it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||
| 67 | |||||||||||||||||||||||
| 68 | The full text of the license can be found in the | ||||||||||||||||||||||
| 69 | LICENSE file included with this module. | ||||||||||||||||||||||
| 70 | |||||||||||||||||||||||
| 71 | =cut | ||||||||||||||||||||||