blib/lib/Module/Install/AutoLicense.pm

filter: Statementstmt 41.6% 15 / 36 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 66.6% 4 / 6 Podpod 100% 1 / 1 totaltotal 35.0% 20 / 57 CC 7 SCAR 31.1
CC
7
Cov
32%
auto_license
42.0
_get_authors
6.0
BEGIN
1.0
CRAP 22.3
« inc/Module/Install/Can.pm ↑ Summary dist/t9vPd3GCmf/Foo-Bar-0.01/inc/Module/Install/AutoLicense.pm »
1 package Module::Install::AutoLicense;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use base qw(Module::Install::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 $VERSION = '0.10';
9  
10 2 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 0 ▶sub auto_license {
Subroutine auto_license: not called CC=6 SCAR=37.4
Pod documented
26 0 my $self = shift;
27 0 ▶ return unless $Module::Install::AUTHOR;
Branch: 1 branch
BranchTrueFalseTotal
unless $Module::Install::AUTHOR 0 0 0
28 0 my %opts = @_;
29 0 $opts{lc $_} = delete $opts{$_} for keys %opts;
30 0 ▶ my $holder = $opts{holder} || _get_authors( $self );
Condition0%0/3
$opts{'holder'} || _get_authors($self)
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts{'holder'} || _get_authors($self)
$opts{'holder'} _get_authors($self)
Truth table0%0/3
A || B
A= $opts{'holder'}B= _get_authors($self)
ABresult
1X1
011
000
31 #my $holder = $opts{holder} || $self->author;
32 0 my $license = $self->license();
33 0 ▶ unless ( defined $licenses{ $license } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $licenses{$license}) 0 0 0
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 ▶ open LICENSE, '>LICENSE' or die "$!\n";
Branch: 1 branch
BranchTrueFalseTotal
open LICENSE, ">LICENSE" or die "$!\n" 0 0 0
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 0 ▶sub _get_authors {
Subroutine _get_authors: not called CC=2 SCAR=17.9
54 0 my $self = shift;
55 0 ▶ my $joined = join ', ', @{ $self->author() || [] };
Condition0%0/2
$self->author || []
l!l
00
MC/DC0%0/1
$self->author || []
$self->author
Truth table0%0/2
A
A= $self->author
Aresult
11
00
56 0 return $joined;
57 }
58  
59 2 'Licensed to auto';
60 __END__
« inc/Module/Install/Can.pm ↑ Summary dist/t9vPd3GCmf/Foo-Bar-0.01/inc/Module/Install/AutoLicense.pm »