App-Genpass
view release on metacpan or search on metacpan
use App::Genpass;
my $genpass = App::Genpass->new();
my $single_password = $genpass->generate(1); # returns scalar
my @single_password = $genpass->generate(1); # returns array
my @multiple_passwords = $genpass->generate(10); # returns array again
my $multiple_passwords = $genpass->generate(10); # returns arrayref
This distribution includes a program called genpass, which is a command
line interface to this module. If you need a program that generates
passwords, use genpass.
SUBROUTINES/METHODS
new
Creates a new instance. It gets a lot of options.
new_with_options
Creates a new instance while reading the command line parameters.
parse_opts
Parses the command line options.
configfile
An attribute defining the configuration file that will be used. If one
is not provided, it tries to find one on its own. It checks for a
.genpass.yaml in your home directory (using File::HomeDir), and then
for /etc/genpass.yaml.
If one is available, that's what it uses. Otherwise nothing.
You must use the new_with_options method described above for this.
flags
These are boolean flags which change the way App::Genpass works.
number
You can decide how many passwords to create. The default is 1.
This can be overridden per generate so you can have a default of 30
but in a specific case only generate 2, if that's what you want.
readable
Use only readable characters, excluding confusing characters: "o",
"O", "0", "l", "1", "I", and special characters such as '#', '!', '%'
and other symbols.
You can overwrite what characters are considered unreadable under
"character attributes" below.
Default: on.
verify
Verify that every type of character wanted (lowercase, uppercase,
numerical, specials, etc.) are present in the password. This makes it
just a tad slower, but it guarantees the result. Best keep it on.
To emphasize how "slower" it is: if you create 500 passwords of 500
character length, using verify off, will make it faster by 0.1
seconds.
Default: on.
attributes
minlength
The minimum length of password to generate.
Default: 8.
maxlength
The maximum length of password to generate.
Default: 10.
length
Use this if you want to explicitly specify the length of password to
generate.
character attributes
These are the attributes that control the types of characters. One can
change which lowercase characters will be used or whether they will be
used at all, for example.
# only a,b,c,d,e,g will be consdered lowercase and no uppercase at all
my $gp = App::Genpass->new( lowercase => [ 'a' .. 'g' ], uppercase => [] );
lowercase
All lowercase characters, excluding those that are considered
unreadable if the readable flag (described above) is turned on.
Default: [ 'a' .. 'z' ] (not including excluded chars).
uppercase
All uppercase characters, excluding those that are considered
unreadable if the readable flag (described above) is turned on.
Default: [ 'A' .. 'Z' ] (not including excluded chars).
numerical
All numerical characters, excluding those that are considered
unreadable if the readable flag (described above) is turned on.
Default: [ '0' .. '9' ] (not including excluded chars).
unreadable
All characters which are considered (by me) unreadable. You can
change this to what you consider unreadable characters. For example:
my $gp = App::Genpass->new( unreadable => [ qw(jlvV) ] );
( run in 0.922 second using v1.01-cache-2.11-cpan-39bf76dae61 )