dist/t9vPd3GCmf/Foo-Bar-0.01/inc/Module/Install/AutoLicense.pm

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