1SYNOPSIS
2
3 use App::Genpass;
4
5 my $genpass = App::Genpass->new();
6 print $genpass->generate, "\n";
7
8 $genpass = App::Genpass->new( readable => 0, length => 20 );
9 print "$_\n" for $genpass->generate(10);
10
11DESCRIPTION
12
13 If you've ever needed to create 10 (or even 10,000) passwords on the
14 fly with varying preferences (lowercase, uppercase, no confusing
15 characters, special characters, minimum length, etc.), you know it can
16 become a pretty pesky task.
17
18 This module makes it possible to create flexible and secure passwords,
19 quickly and easily.
20
21 use App::Genpass;
22 my $genpass = App::Genpass->new();
23
24 my $single_password = $genpass->generate(1); # returns scalar
25 my @single_password = $genpass->generate(1); # returns array
26 my @multiple_passwords = $genpass->generate(10); # returns array again
27 my $multiple_passwords = $genpass->generate(10); # returns arrayref
28
29 This distribution includes a program called genpass, which is a command
30 line interface to this module. If you need a program that generates
31 passwords, use genpass.
32
33SUBROUTINES/METHODS
34
35 new
36
37 Creates a new instance. It gets a lot of options.
38
39 new_with_options
40
41 Creates a new instance while reading the command line parameters.
42
43 parse_opts
44
45 Parses the command line options.
46
47 configfile
48
49 An attribute defining the configuration file that will be used. If one
50 is not provided, it tries to find one on its own. It checks for a
51 .genpass.yaml in your home directory (using File::HomeDir), and then
52 for /etc/genpass.yaml.
53
54 If one is available, that's what it uses. Otherwise nothing.
55
56 You must use the new_with_options method described above for this.
57
58 flags
59
60 These are boolean flags which change the way App::Genpass works.
61
62 number
63
64 You can decide how many passwords to create. The default is 1.
65
66 This can be overridden per generate so you can have a default of 30
67 but in a specific case only generate 2, if that's what you want.
68
69 readable
70
71 Use only readable characters, excluding confusing characters: "o",
72 "O", "0", "l", "1", "I", and special characters such as '#', '!', '%'
73 and other symbols.
74
75 You can overwrite what characters are considered unreadable under
76 "character attributes" below.
77
78 Default: on.
79
80 verify
81
82 Verify that every type of character wanted (lowercase, uppercase,
83 numerical, specials, etc.) are present in the password. This makes it
84 just a tad slower, but it guarantees the result. Best keep it on.
85
86 To emphasize how "slower" it is: if you create 500 passwords of 500
87 character length, using verify off, will make it faster by 0.1
88 seconds.
89
90 Default: on.
91
92 attributes
93
94 minlength
95
96 The minimum length of password to generate.
97
98 Default: 8.
99
100 maxlength
101
102 The maximum length of password to generate.
103
104 Default: 10.
105
106 length
107
108 Use this if you want to explicitly specify the length of password to
109 generate.
110
111 character attributes
112
113 These are the attributes that control the types of characters. One can
114 change which lowercase characters will be used or whether they will be
115 used at all, for example.
116
117 # only a,b,c,d,e,g will be consdered lowercase and no uppercase at all
118 my $gp = App::Genpass->new( lowercase => [ 'a' .. 'g' ], uppercase => [] );
119
120 lowercase
121
122 All lowercase characters, excluding those that are considered
123 unreadable if the readable flag (described above) is turned on.
124
125 Default: [ 'a' .. 'z' ] (not including excluded chars).
126
127 uppercase
128
129 All uppercase characters, excluding those that are considered
130 unreadable if the readable flag (described above) is turned on.
131
132 Default: [ 'A' .. 'Z' ] (not including excluded chars).
133
134 numerical
135
136 All numerical characters, excluding those that are considered
137 unreadable if the readable flag (described above) is turned on.
138
139 Default: [ '0' .. '9' ] (not including excluded chars).
140
141 unreadable
142
143 All characters which are considered (by me) unreadable. You can
144 change this to what you consider unreadable characters. For example:
145
146 my $gp = App::Genpass->new( unreadable => [ qw(jlvV) ] );
147
148 After all the characters are set, unreadable characters will be
149 removed from all sets.
150
151 Thus, unreadable characters override all other sets. You can make
152 unreadable characters not count by using the readable => 0 option,
153 described by the readable flag above.
154
155 specials
156
157 All special characters.
158
159 Default: [ '!', '@', '#', '$', '%', '^', '&', '*', '(', ')' ].
160
161 (not including excluded chars)
162
163 generate
164
165 This method generates the password or passwords.
166
167 It accepts an optional parameter indicating how many passwords to
168 generate.
169
170 $gp = App::Genpass->new();
171 my @passwords = $gp->generate(300); # 300 passwords to go
172
173 If you do not provide a parameter, it will use the default number of
174 passwords to generate, defined by the attribute number explained above.
175
176 This method tries to be tricky and DWIM (or rather, DWYM). That is, if
177 you request it to generate only one password and use scalar context (my
178 $p = $gp->generate(1)), it will return a single password.
179
180 However, if you try to generate multiple passwords and use scalar
181 context (my $p = $gp->generate(30)), it will return an array reference
182 for the passwords.
183
184 Generating passwords with list context (my @p = $gp->generate(...))
185 will always return a list of the passwords, even if it's a single
186 password.
187
188 get_config_from_file
189
190 Reads the configuration file using Config::Any.
191
192 Shamelessly lifted from MooseX::SimpleConfig.
193
194AUTHOR
195
196 Sawyer X, <xsawyerx at cpan.org>
197
198DEPENDENCIES
199
200 Carp
201
202 Moo
203
204 MooX::Types::MooseLike
205
206 Getopt::Long
207
208 File::Spec
209
210 Config::Any
211
212 File::HomeDir
213
214 List::AllUtils
215
216BUGS AND LIMITATIONS
217
218 Please report any bugs or feature requests to bug-app-genpass at
219 rt.cpan.org, or through the web interface at
220 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-Genpass. I will be
221 notified, and then you'll automatically be notified of progress on your
222 bug as I make changes.
223
224SUPPORT
225
226 You can find documentation for this module with the perldoc command.
227
228 perldoc App::Genpass
229
230 You can also look for information at:
231
232 * Github: App::Genpass repository
233
234 http://github.com/xsawyerx/app-genpass
235
236 * RT: CPAN's request tracker
237
238 http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-Genpass
239
240 * AnnoCPAN: Annotated CPAN documentation
241
242 http://annocpan.org/dist/App-Genpass
243
244 * CPAN Ratings
245
246 http://cpanratings.perl.org/d/App-Genpass
247
248 * Search CPAN
249
250 http://search.cpan.org/dist/App-Genpass/
251
252