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->err;
The error code of the last check. Returns a false value, if the last check was successful.
false
print $pwdm->errstr; print $pwdm->errstr(4);
The error string of the last check, or, in case an error code is passed, the corresponding message. Returns an empty string, if the last check was successful.
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 codes and strings are:
1. There is no password given
2. Passwords are not allowed to contain control sequences
3. Passwords are not allowed to consist of repeating characters only
4. The password is too short
5. The password should contain special characters
6. The password should contain combinations of letters, numbers and special characters
7. The password is too short and should contain special characters
8. The password is too short and should contain combinations of letters, numbers and special characters
9. The password should contain special characters and should contain combinations of letters, numbers and special characters
10. The password is too short, 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-2016, 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.