Data::Password::Meter - Check the strength of passwords
my $pwdm = Data::Password::Meter->new(28); # Check a password if ($pwdm->strong('s3cur3-p4ssw0rd')) { print "The password is strong enough!\n"; print 'Scored ' . $pwdm->score . ' points!'; } else { warn $pwdm->errstr; };
Check the strength of a password. The scoring is based on Passwordmeter by Steve Moitozo.
print $pwdm->errstr;
The error string of the last failing check.
print $pwdm->score;
The score of the last check.
print $pwdm->threshold; $pwdm->threshold(28);
The scoring threshold, the determining factor when a password is too weak. Every password that is below this threshold is considered weak. Defaults to a score of 25.
25
my $pwd = Data::Password::Meter->new(28);
Constructs a new password check object. Accepts an optional value for the threshold.
if ($pwdm->strong('mypassword')) { print 'This password is strong!'; } else { print 'This password is weak!'; };
Checks a password for strength. Returns a false value in case the password is considered to be weak.
Possible error strings are:
There is no password given
Passwords are not allowed to contain control sequences
Passwords are not allowed to consist of repeating characters only
The password is too short
The password should contain special characters
The password should contain combinations of letters, numbers and special characters
The password is too short and should contain special characters
The password is too short and should contain combinations of letters, numbers and special characters
The password is too short, should contain special characters and should contain combinations of letters, numbers and special characters
The password should contain special characters and should contain combinations of letters, numbers and special characters
No dependencies other than core.
https://github.com/Akron/Data-Password-Meter
Copyright (C) 2006, Steve Moitozo, (C) 2013, Nils Diewald.
Licensed under the MIT License
To install Data::Password::Meter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Password::Meter
CPAN shell
perl -MCPAN -e shell install Data::Password::Meter
For more information on module installation, please visit the detailed CPAN module installation guide.