| 1 | package Password::Policy::Rule::Length; | ||||||||||
| 2 | 4 | $Password::Policy::Rule::Length::VERSION = '0.06'; | |||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 4 | ▶ | use parent 'Password::Policy::Rule'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use String::Multibyte; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 4 | ▶ | use Password::Policy::Exception::InsufficientLength; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 2 | ▶ | sub default_arg { return 8; } | ||||||||
|
Subroutine
default_arg: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 13 | |||||||||||
| 14 | 20 | ▶ | sub check { | ||||||||
|
Subroutine
check: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 15 | 20 | my $self = shift; | |||||||||
| 16 | 20 | my $password = $self->prepare(shift); | |||||||||
| 17 | 19 | my $strmb = String::Multibyte->new('UTF8'); | |||||||||
| 18 | 19 | ▶ | if($strmb->islegal($password)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 18 | my $len = $strmb->length($password); | |||||||||
| 20 | 18 | ▶ | if($len < $self->arg) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 4 | Password::Policy::Exception::InsufficientLength->throw; | |||||||||
| 22 | } | ||||||||||
| 23 | } else { | ||||||||||
| 24 | 1 | my $len = length $password; | |||||||||
| 25 | 1 | ▶ | if($len < $self->arg) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | Password::Policy::Exception::InsufficientLength->throw; | |||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | 15 | return 1; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 4 | 1; | |||||||||
| 33 | |||||||||||
| 34 | __END__ | ||||||||||