App-Genpass

 view release on metacpan or  search on metacpan

lib/App/Genpass.pm  view on Meta::CPAN

    print $genpass->generate, "\n";

    $genpass = App::Genpass->new( readable => 0, length => 20 );
    print "$_\n" for $genpass->generate(10);

=head1 DESCRIPTION

If you've ever needed to create 10 (or even 10,000) passwords on the fly with
varying preferences (lowercase, uppercase, no confusing characters, special
characters, minimum length, etc.), you know it can become a pretty pesky task.

This module makes it possible to create flexible and secure passwords, quickly
and easily.

    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 B<genpass>, which is a command line
interface to this module. If you need a program that generates passwords, use
B<genpass>.

=for stopwords boolean DWIM DWYM arrayref perldoc Github CPAN's AnnoCPAN CPAN

=head1 SUBROUTINES/METHODS

=head2 new

Creates a new instance. It gets a lot of options.

=head2 new_with_options

Creates a new instance while reading the command line parameters.

=head2 parse_opts

Parses the command line options.

=head2 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 C<.genpass.yaml> in
your home directory (using L<File::HomeDir>), and then for C</etc/genpass.yaml>.

If one is available, that's what it uses. Otherwise nothing.

You must use the C<new_with_options> method described above for this.

=head3 flags

These are boolean flags which change the way App::Genpass works.

=over 4

=item number

You can decide how many passwords to create. The default is 1.

This can be overridden per I<generate> so you can have a default of 30 but in a
specific case only generate 2, if that's what you want.

=item 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.

=item 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 C<verify> off, will make it faster by 0.1 seconds.

Default: on.

=back

=head3 attributes

=over 4

=item minlength

The minimum length of password to generate.

Default: 8.

=item maxlength

The maximum length of password to generate.

Default: 10.

=item length

Use this if you want to explicitly specify the length of password to generate.

=back

=head3 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 => [] );

=over 4



( run in 1.448 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )