Subject: | Data-Password-BasicCheck |
#!/usr/bin/perl -w
use Data::Password::BasicCheck;
use strict;
use warnings;
use Test::More qw(no_plan) ;
my @userinfo = (qw(bronto Marco Marongiu),'San Gavino') ;
my $ok = Data::Password::BasicCheck->OK ;
my $dpbc58 ;
eval { $dpbc58 = Data::Password::BasicCheck->new(5,15) } ; ###maximum length more than single digit
is($@,'','Object created ok') ;
my $good = 'c0m&c@z%' ;
my @passwords = ('shrt', # too short
'waytoolong', # too long
'pitbull', # doesn't contain digits/symbols
'!@#$%^&', # doesn't contain digits/alphas
'12345678', # doesn't contain symbols/alphas
'pitbul1', # doesn't contain symbols
'pitbull@', # doesn't contain digits
'!@#$1234', # doesn't contain alphas
) ;
is($ok,$dpbc58->check($good,@userinfo),"$good is good") ;
foreach (@passwords) {
my $check = $dpbc58->check($_,@userinfo) ;
isnt($ok,$check,"$_: $check") ;
}
gives:
ok 1 - Object created ok
Can't call method "check" on an undefined value at test.pl line 28.
1..1
# Looks like your test died just after 1.
When maximum length is specified as greater than a single digit.