inc/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 0.0% 0 / 1 totaltotal 33.3% 19 / 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 inc/Module/Install.pm »
1 #line 1
2 package Module::Install::AutoLicense;
3 2 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use base qw(Module::Install::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 use vars qw($VERSION);
8 2  
9 $VERSION = '0.10';
10 2  
11 my %licenses = (
12 perl => 'Software::License::Perl_5',
13 apache => 'Software::License::Apache_2_0',
14 artistic => 'Software::License::Artistic_1_0',
15 artistic_2 => 'Software::License::Artistic_2_0',
16 lgpl2 => 'Software::License::LGPL_2_1',
17 lgpl3 => 'Software::License::LGPL_3_0',
18 bsd => 'Software::License::BSD',
19 gpl => 'Software::License::GPL_1',
20 gpl2 => 'Software::License::GPL_2',
21 gpl3 => 'Software::License::GPL_3',
22 mit => 'Software::License::MIT',
23 mozilla => 'Software::License::Mozilla_1_1',
24 );
25 0 ▶ 
Subroutine auto_license: not called CC=6 SCAR=37.4
Pod undocumented
26 0 sub auto_license {
27 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
unless $Module::Install::AUTHOR 0 0 0
28 0 return unless $Module::Install::AUTHOR;
29 0 my %opts = @_;
30 0 ▶ $opts{lc $_} = delete $opts{$_} for keys %opts;
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} || _get_authors( $self );
32 0 #my $holder = $opts{holder} || $self->author;
33 0 ▶ my $license = $self->license();
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $licenses{$license}) 0 0 0
34 0 unless ( defined $licenses{ $license } ) {
35 0 warn "No license definition for '$license', aborting\n";
36 return 1;
37 0 }
38 0 my $class = $licenses{ $license };
39 0 eval "require $class";
40 0 ▶ my $sl = $class->new( { holder => $holder } );
Branch: 1 branch
BranchTrueFalseTotal
open LICENSE, ">LICENSE" or die "$!\n" 0 0 0
41 0 open LICENSE, '>LICENSE' or die "$!\n";
42 0 print LICENSE $sl->fulltext;
43 0 close LICENSE;
44 $self->postamble(<<"END");
45 distclean :: license_clean
46  
47 license_clean:
48 \t\$(RM_F) LICENSE
49 END
50 0  
51 return 1;
52 }
53 0 ▶ 
Subroutine _get_authors: not called CC=2 SCAR=17.9
54 0 sub _get_authors {
55 0 ▶ my $self = shift;
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 my $joined = join ', ', @{ $self->author() || [] };
57 return $joined;
58 }
59 2  
60 'Licensed to auto';
61 __END__
« inc/Module/Install/Can.pm ↑ Summary inc/Module/Install.pm »