| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::Install::AutoLicense; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
29984
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
36
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use base qw(Module::Install::Base); |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
780
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
380
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.08'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %licenses = ( |
|
11
|
|
|
|
|
|
|
perl => 'Software::License::Perl_5', |
|
12
|
|
|
|
|
|
|
apache => 'Software::License::Apache_2_0', |
|
13
|
|
|
|
|
|
|
artistic => 'Software::License::Artistic_1_0', |
|
14
|
|
|
|
|
|
|
artistic_2 => 'Software::License::Artistic_2_0', |
|
15
|
|
|
|
|
|
|
lgpl2 => 'Software::License::LGPL_2_1', |
|
16
|
|
|
|
|
|
|
lgpl3 => 'Software::License::LGPL_3_0', |
|
17
|
|
|
|
|
|
|
bsd => 'Software::License::BSD', |
|
18
|
|
|
|
|
|
|
gpl => 'Software::License::GPL_1', |
|
19
|
|
|
|
|
|
|
gpl2 => 'Software::License::GPL_2', |
|
20
|
|
|
|
|
|
|
gpl3 => 'Software::License::GPL_3', |
|
21
|
|
|
|
|
|
|
mit => 'Software::License::MIT', |
|
22
|
|
|
|
|
|
|
mozilla => 'Software::License::Mozilla_1_1', |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub auto_license { |
|
26
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
27
|
0
|
0
|
|
|
|
|
return unless $Module::Install::AUTHOR; |
|
28
|
0
|
|
|
|
|
|
my %opts = @_; |
|
29
|
0
|
|
|
|
|
|
$opts{lc $_} = delete $opts{$_} for keys %opts; |
|
30
|
0
|
|
0
|
|
|
|
my $holder = $opts{holder} || _get_authors( $self ); |
|
31
|
|
|
|
|
|
|
#my $holder = $opts{holder} || $self->author; |
|
32
|
0
|
|
|
|
|
|
my $license = $self->license(); |
|
33
|
0
|
0
|
|
|
|
|
unless ( defined $licenses{ $license } ) { |
|
34
|
0
|
|
|
|
|
|
warn "No license definition for '$license', aborting\n"; |
|
35
|
0
|
|
|
|
|
|
return 1; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
0
|
|
|
|
|
|
my $class = $licenses{ $license }; |
|
38
|
0
|
|
|
|
|
|
eval "require $class"; |
|
39
|
0
|
|
|
|
|
|
my $sl = $class->new( { holder => $holder } ); |
|
40
|
0
|
0
|
|
|
|
|
open LICENSE, '>LICENSE' or die "$!\n"; |
|
41
|
0
|
|
|
|
|
|
print LICENSE $sl->fulltext; |
|
42
|
0
|
|
|
|
|
|
close LICENSE; |
|
43
|
0
|
|
|
|
|
|
$self->postamble(<<"END"); |
|
44
|
|
|
|
|
|
|
distclean :: license_clean |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
license_clean: |
|
47
|
|
|
|
|
|
|
\t\$(RM_F) LICENSE |
|
48
|
|
|
|
|
|
|
END |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return 1; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _get_authors { |
|
54
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
55
|
0
|
0
|
|
|
|
|
my $joined = join ', ', @{ $self->author() || [] }; |
|
|
0
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $joined; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
'Licensed to auto'; |
|
60
|
|
|
|
|
|
|
__END__ |