14 Oct 2016 21:27:13 UTC
- Distribution: App-Genpass
- Module version: 2.401
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Issues (1)
- Testers (656 / 0 / 0)
- KwaliteeBus factor: 1
- 62.21% Coverage
- License: perl_5
- Activity24 month
- Download (21.56KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionXSAWYERX Sawyer X
- BUGS AND LIMITATIONS
- COPYRIGHT AND LICENSE
App::Genpass - Quickly and easily create secure passwords
use App::Genpass; my $genpass = App::Genpass->new(); print $genpass->generate, "\n"; $genpass = App::Genpass->new( readable => 0, length => 20 ); print "$_\n" for $genpass->generate(10);
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 genpass, which is a command line interface to this module. If you need a program that generates passwords, use genpass.
Creates a new instance. It gets a lot of options.
Creates a new instance while reading the command line parameters.
Parses the command line options.
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.yamlin your home directory (using File::HomeDir), and then for
If one is available, that's what it uses. Otherwise nothing.
You must use the
new_with_optionsmethod described above for this.
These are boolean flags which change the way App::Genpass works.
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.
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.
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
verifyoff, will make it faster by 0.1 seconds.
The minimum length of password to generate.
The maximum length of password to generate.
Use this if you want to explicitly specify the length of password to generate.
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 =>  );
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).
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).
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).
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) ] );
After all the characters are set, unreadable characters will be removed from all sets.
Thus, unreadable characters override all other sets. You can make unreadable characters not count by using the
readable => 0option, described by the readable flag above.
All special characters.
Default: [ '!', '@', '#', '$', '%', '^', '&', '*', '(', ')' ].
(not including excluded chars)
This method generates the password or passwords.
It accepts an optional parameter indicating how many passwords to generate.
$gp = App::Genpass->new(); my @passwords = $gp->generate(300); # 300 passwords to go
If you do not provide a parameter, it will use the default number of passwords to generate, defined by the attribute number explained above.
This method tries to be tricky and DWIM (or rather, DWYM). That is, if you request it to generate only one password and use scalar context (
my $p = $gp->generate(1)), it will return a single password.
However, if you try to generate multiple passwords and use scalar context (
my $p = $gp->generate(30)), it will return an array reference for the passwords.
Generating passwords with list context (
my @p = $gp->generate(...)) will always return a list of the passwords, even if it's a single password.
Reads the configuration file using Config::Any.
Shamelessly lifted from MooseX::SimpleConfig.
<xsawyerx at cpan.org>
Please report any bugs or feature requests to
bug-app-genpass at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-Genpass. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
You can also look for information at:
Github: App::Genpass repository
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
Sawyer X <email@example.com>
This software is copyright (c) 2011 by Sawyer X.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.