View on
MetaCPAN
Nils Diewald > Data-Password-Meter-0.08 > Data::Password::Meter

Download:
Data-Password-Meter-0.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.08   Source  

NAME ^

Data::Password::Meter - Check the strength of passwords

SYNOPSIS ^

  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;
  };

DESCRIPTION ^

Check the strength of a password. The scoring is based on Passwordmeter by Steve Moitozo.

ATTRIBUTES ^

err

  print $pwdm->err;

The error code of the last check. Returns a false value, if the last check was successful.

errstr

  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.

score

  print $pwdm->score;

The score of the last check.

threshold

  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.

METHODS ^

new

  my $pwd = Data::Password::Meter->new(28);

Constructs a new password check object. Accepts an optional value for the threshold.

strong

  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.

ERROR MESSAGES ^

Possible error codes and strings are:

DEPENDENCIES ^

No dependencies other than core.

AVAILABILITY ^

  https://github.com/Akron/Data-Password-Meter

COPYRIGHT AND LICENSE ^

Copyright (C) 2006, Steve Moitozo, (C) 2013-2016, Nils Diewald.

Licensed under the MIT License

syntax highlighting: