line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Software::License; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
43350
|
use Moo; |
|
3
|
|
|
|
|
27411
|
|
|
3
|
|
|
|
|
11
|
|
8
|
3
|
|
|
3
|
|
5404
|
use MooX::Options; |
|
3
|
|
|
|
|
60158
|
|
|
3
|
|
|
|
|
13
|
|
9
|
3
|
|
|
3
|
|
184185
|
use File::HomeDir; |
|
3
|
|
|
|
|
13538
|
|
|
3
|
|
|
|
|
174
|
|
10
|
3
|
|
|
3
|
|
1018
|
use File::Spec::Functions qw/catfile/; |
|
3
|
|
|
|
|
1132
|
|
|
3
|
|
|
|
|
143
|
|
11
|
3
|
|
|
3
|
|
13
|
use Module::Runtime qw/use_module/; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
21
|
|
12
|
3
|
|
|
3
|
|
1227
|
use Software::License; |
|
3
|
|
|
|
|
21570
|
|
|
3
|
|
|
|
|
89
|
|
13
|
3
|
|
|
3
|
|
1976
|
use Config::Any; |
|
3
|
|
|
|
|
16836
|
|
|
3
|
|
|
|
|
114
|
|
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
1193
|
use namespace::autoclean 0.16 -except => [qw/_options_data _options_config/]; |
|
3
|
|
|
|
|
20773
|
|
|
3
|
|
|
|
|
16
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
option holder => ( |
39
|
|
|
|
|
|
|
is => 'ro', |
40
|
|
|
|
|
|
|
required => 1, |
41
|
|
|
|
|
|
|
format => 's', |
42
|
|
|
|
|
|
|
doc => '', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
option year => ( |
52
|
|
|
|
|
|
|
is => 'ro', |
53
|
|
|
|
|
|
|
format => 'i', |
54
|
|
|
|
|
|
|
doc => '', |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
option license => ( |
65
|
|
|
|
|
|
|
is => 'ro', |
66
|
|
|
|
|
|
|
default => 'Perl_5', |
67
|
|
|
|
|
|
|
format => 's', |
68
|
|
|
|
|
|
|
doc => '', |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
option type => ( |
111
|
|
|
|
|
|
|
is => 'ro', |
112
|
|
|
|
|
|
|
default => 'notice', |
113
|
|
|
|
|
|
|
format => 's', |
114
|
|
|
|
|
|
|
doc => '', |
115
|
|
|
|
|
|
|
); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
option configfile => ( |
124
|
|
|
|
|
|
|
is => 'ro', |
125
|
|
|
|
|
|
|
default => catfile(File::HomeDir->my_home, '.software_license.conf'), |
126
|
|
|
|
|
|
|
format => 's', |
127
|
|
|
|
|
|
|
doc => '', |
128
|
|
|
|
|
|
|
order => 100, |
129
|
|
|
|
|
|
|
); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
has _software_license => ( |
132
|
|
|
|
|
|
|
is => 'ro', |
133
|
|
|
|
|
|
|
isa => sub { die "Not a Software::License" if !$_[0]->isa('Software::License') }, |
134
|
|
|
|
|
|
|
lazy => 1, |
135
|
|
|
|
|
|
|
builder => '_build__software_license', |
136
|
|
|
|
|
|
|
handles => { |
137
|
|
|
|
|
|
|
notice => 'notice', |
138
|
|
|
|
|
|
|
text => 'license', |
139
|
|
|
|
|
|
|
fulltext => 'fulltext', |
140
|
|
|
|
|
|
|
version => 'version', |
141
|
|
|
|
|
|
|
}, |
142
|
|
|
|
|
|
|
); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub _build__software_license { |
145
|
7
|
|
|
7
|
|
1311
|
my ($self) = @_; |
146
|
7
|
|
|
|
|
9
|
my $class = "Software::License::${\$self->license}"; |
|
7
|
|
|
|
|
33
|
|
147
|
|
|
|
|
|
|
|
148
|
7
|
|
|
|
|
21
|
return use_module($class)->new({ |
149
|
|
|
|
|
|
|
holder => $self->holder, |
150
|
|
|
|
|
|
|
year => $self->year, |
151
|
|
|
|
|
|
|
}); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub BUILDARGS { |
155
|
7
|
|
|
7
|
0
|
22478
|
my $class = shift; |
156
|
|
|
|
|
|
|
|
157
|
7
|
|
|
|
|
12
|
my $args = { @_ }; |
158
|
7
|
|
66
|
|
|
43
|
my $configfile = $args->{'configfile'} || catfile(File::HomeDir->my_home, '.software_license.conf'); |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
7
|
100
|
100
|
|
|
214
|
if(!exists $args->{'license'} && scalar @ARGV && $ARGV[-1] !~ m{^--.+=.+} && (!scalar (@_) || $ARGV[-1] ne $_[-1])) { |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
162
|
4
|
|
|
|
|
5
|
$args->{'license'} = $ARGV[-1]; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
7
|
100
|
|
|
|
122
|
if(-e $configfile) { |
166
|
2
|
|
|
|
|
19
|
my $conf = Config::Any->load_files({ files => [$configfile], use_ext => 0, flatten_to_hash => 1 })->{ $configfile }; |
167
|
2
|
|
|
|
|
29905
|
$args = { %$conf, %$args }; |
168
|
|
|
|
|
|
|
} |
169
|
7
|
|
|
|
|
128
|
return $args; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub run { |
173
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
174
|
0
|
|
|
|
|
|
my $meth = $self->type; |
175
|
0
|
|
|
|
|
|
print $self->_software_license->$meth; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
__END__ |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=pod |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=encoding UTF-8 |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 NAME |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
App::Software::License - Command-line interface to Software::License |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 VERSION |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
version 0.05 |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 SYNOPSIS |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
software-license --holder 'J. Random Hacker' --license Perl_5 --type notice |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 DESCRIPTION |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
This module provides a command-line interface to Software::License. It can be |
201
|
|
|
|
|
|
|
used to easily produce license notices to be included in other documents. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
All the attributes documented below are available as command-line options |
204
|
|
|
|
|
|
|
through L<MooX::Options> and can also be configured in |
205
|
|
|
|
|
|
|
F<$HOME/.software_license.conf> through L<Config::Any>. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head2 holder |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Name of the license holder. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 year |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Year to be used in the copyright notice. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 license |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Name of the license to use. Must be the name of a module available under the |
220
|
|
|
|
|
|
|
Software::License:: namespace. Defaults to Perl_5. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 type |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
The type of license notice you'd like to generate. Available values are: |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
B<* notice> |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
This method returns a snippet of text, usually a few lines, indicating the |
229
|
|
|
|
|
|
|
copyright holder and year of copyright, as well as an indication of the license |
230
|
|
|
|
|
|
|
under which the software is distributed. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
B<* license> |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
This method returns the full text of the license. |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 configfile |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Path to the optional configuration file. Defaults to C<$HOME/.software_license.conf>. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=for :stopwords fulltext |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
B<* fulltext> |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This method returns the complete text of the license, preceded by the copyright |
245
|
|
|
|
|
|
|
notice. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
B<* version> |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=for :stopwords versioned |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
This method returns the version of the license. If the license is not |
252
|
|
|
|
|
|
|
versioned, this returns nothing. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
B<* meta_yml_name> |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
This method returns the string that should be used for this license in the CPAN |
257
|
|
|
|
|
|
|
META.yml file, or nothing if there is no known string to use. |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=for Pod::Coverage run |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=for Pod::Coverage BUILDARGS |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head1 SUPPORT |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=App-Software-License> |
266
|
|
|
|
|
|
|
(or L<bug-App-Software-License@rt.cpan.org|mailto:bug-App-Software-License@rt.cpan.org>). |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
269
|
|
|
|
|
|
|
L<http://lists.perl.org/list/cpan-workers.html>. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
272
|
|
|
|
|
|
|
L<C<#toolchain> on C<irc.perl.org>|irc://irc.perl.org/#toolchain>. |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head1 AUTHOR |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Randy Stauner Erik Carlsson |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=over 4 |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=item * |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=item * |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
Randy Stauner <rwstauner@cpan.org> |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=item * |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=back |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
This software is copyright (c) 2009 by Florian Ragwitz. |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
303
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |
306
|
|
|
|
|
|
|
|