Data::Passphrase::Ruleset - ruleset for validating passphrases
Specified by script file:
my $ruleset = Data::Passphrase::Ruleset->new({ debug => 1, file => '/usr/local/etc/passphrase/rules', }); my $passphrase_object = Data::Passphrase->new({ ruleset => $ruleset, # putting the filename here also works });
Passing rules in as Data::Passphrase::Rule objects or directly:
my $rule = Data::Passphrase::Rule->new({ code => 450, message => 'is too short', test => 'X' x 15, validate => sub { $_[0] >= 15 }, }); my $ruleset = Data::Passphrase::Ruleset->new({ rules => [ $rule, { code => 452, message => 'may not contain # or @', test => [ 'this passphrase contains #', '@ appears in this one', ], validate => sub { $_[0] !~ /([#@])/ }, }, ] }); my $passphrase_object = Data::Passphrase->new({ ruleset => $ruleset, });
Objects of this class represent a list of strength-checking rules used by Data::Passphrase. In addition to constructor and accessor methods, it provides a method to load rules from a Perl script.
There is a constructor, new, which takes a reference to a hash of initial attribute settings, and accessor methods of the form get_attribute() and set_attribute(). See "Attributes".
new
In addition to the constructor and accessor methods, the following special method is available.
$self->load()
Load or reload rules from the Perl script specified by the file attribute. Rules are only reloaded if the script has been modified since the last time it was evaluated. Either way, after a "load()" in load(), the rules attribute will point to an up-to-date copy of the rules.
The attributes below can be accessed via methods of the form get_attribute() and set_attribute().
If TRUE, enable debugging to the Apache error log.
The filename of a Perl script that, when evaluated, returns a list of rules. Each rule is specified as either an Data::Passphrase::Rule object or a hash reference used to construct one.
The lowest score a rule's validate routine can return for the passphrase to pass that rule. Defaults to 0.6.
A reference to an array of rules. Each rule is specified as either an Data::Passphrase::Rule object or a hash reference used to construct one.
See Data::Passphrase and the included passphrase_rules file.
passphrase_rules
Andrew J. Korty <ajk@iu.edu>
Data::Passphrase(3), Data::Passphrase::Rule(3)
To install Data::Passphrase, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Passphrase
CPAN shell
perl -MCPAN -e shell install Data::Passphrase
For more information on module installation, please visit the detailed CPAN module installation guide.