Sign in to PrePAN

Password::Policy::Rule::Pwned Plug matches against into Password::Policy



use Password::Policy;
use Password::Policy::Rule::Pwned;
use Try::Tiny;

my $pass = 'password1';

my $pp = Password::Policy->new (config => 'policy.yaml');
try {
    $pp->process({ password => $pass });
} catch {
    warn "This password '$pass' is pwned - don't use it";
    # Other actions


Password::Policy::Rule::Pwned is a Password::Policy::Rule to match against the pwned password service at as specified at

A password found in the list throws an exception as usual. A password not in the list returns itself also as usual.

Following discussions with the author of Password::Policy, it has been decided to throw a separate, distinct, testable error to deal with the 3rd possibility which is a failure in the API call for whatever reason.


Please sign up to post a review.