inc/Module/Install/AutoLicense.pm

filter: Statementstmt 94.4% 34 / 36 Branchbran 50.0% 3 / 6 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 80.7% 46 / 57 CC 7 SCAR 13.9
CC
7
Cov
83%
auto_license
6.7
_get_authors
2.0
BEGIN
1.0
CRAP 4.0
« inc/Module/Install/Win32.pm ↑ Summary inc/Module/Install/Base.pm »
1 #line 1
2 package Module::Install::AutoLicense;
3 5 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use base qw(Module::Install::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 use vars qw($VERSION);
8 5  
9 $VERSION = '0.10';
10 5  
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 3 ▶ 
Subroutine auto_license: called CC=6 SCAR=19.0
Pod documented
26 3 sub auto_license {
27 3 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
unless $Module::Install::AUTHOR 0 3 3
28 3 return unless $Module::Install::AUTHOR;
29 3 my %opts = @_;
30 3 ▶ $opts{lc $_} = delete $opts{$_} for keys %opts;
Condition33%1/3
$opts{'holder'} || _get_authors($self)
l!l&&r!l&&!r
030
MC/DC0%0/2
$opts{'holder'} || _get_authors($self)
$opts{'holder'} _get_authors($self)
Truth table33%1/3
A || B
A= $opts{'holder'}B= _get_authors($self)
ABresult
1X1
011
000
31 my $holder = $opts{holder} || _get_authors( $self );
32 3 #my $holder = $opts{holder} || $self->author;
33 3 ▶ my $license = $self->license();
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $licenses{$license}) 0 3 3
34 0 unless ( defined $licenses{ $license } ) {
35 0 warn "No license definition for '$license', aborting\n";
36 return 1;
37 3 }
38 3 my $class = $licenses{ $license };
39 3 eval "require $class";
40 3 ▶ my $sl = $class->new( { holder => $holder } );
Branch: 1 branch
BranchTrueFalseTotal
open LICENSE, ">LICENSE" or die "$!\n" 3 0 3
41 3 open LICENSE, '>LICENSE' or die "$!\n";
42 3 print LICENSE $sl->fulltext;
43 3 close LICENSE;
44 $self->postamble(<<"END");
45 distclean :: license_clean
46  
47 license_clean:
48 \t\$(RM_F) LICENSE
49 END
50 3  
51 return 1;
52 }
53 3 ▶ 
Subroutine _get_authors: called CC=2 SCAR=7.0
54 3 sub _get_authors {
55 3 ▶ my $self = shift;
Condition50%1/2
$self->author || []
l!l
30
MC/DC0%0/1
$self->author || []
$self->author
Truth table50%1/2
A
A= $self->author
Aresult
11
00
56 3 my $joined = join ', ', @{ $self->author() || [] };
57 return $joined;
58 }
59 5  
60 'Licensed to auto';
61 __END__
« inc/Module/Install/Win32.pm ↑ Summary inc/Module/Install/Base.pm »