ModuleBuildTiny/Dist.pm

filter: Statementstmt 18.0% 69 / 382 Branchbran 0.6% 1 / 146 Conditioncond 0.0% 0 / 113 MC/DCmcdc 0.0% 0 / 66 Subroutinesub 39.6% 21 / 53 Podpod 0.0% 0 / 24 totaltotal 11.6% 91 / 784 CC 126 SCAR 65.0
CC
126
Cov
11%
new
2352.0
run
156.0
detect_license
132.0
CRAP 666.5
↑ Summary ModuleBuildTiny.pm »
1 package App::ModuleBuildTiny::Dist;
2  
3 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our $VERSION = '0.051';
6  
7 1 ▶use CPAN::Meta;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Encode qw/encode_utf8 decode_utf8/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use File::Basename qw/basename dirname/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use File::Copy qw/copy/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use File::Path qw/mkpath rmtree/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use File::Spec::Functions qw/catfile catdir rel2abs/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use File::Slurper qw/write_text read_text read_binary/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use File::chdir;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use ExtUtils::Manifest qw/manifind maniskip maniread/;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Module::Runtime 'require_module';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Module::Metadata 1.000037;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Pod::Escapes qw/e2char/;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use Pod::Simple::Text 3.23;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use POSIX 'strftime';
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Text::ParseWords 'shellwords';
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 ▶use Env qw/@PERL5LIB @PATH/;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 1 ▶my $Build = $^O eq 'MSWin32' ? 'Build' : './Build';
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'MSWin32' ? : 0 1 1
27  
28 0 ▶sub find {
Subroutine find: not called CC=1 SCAR=6.9
Pod undocumented
29 0 my ($re, @dir) = @_;
30 0 my $ret;
31 0 ▶ File::Find::find(sub { $ret++ if /$re/ }, @dir);
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if /$re/u 0 0 0
32 0 return $ret;
33 }
34  
35 0 ▶sub mbt_version {
Subroutine mbt_version: not called CC=2 SCAR=17.9
Pod undocumented
36 0 ▶ return -f 'dynamic-prereqs.yml' ? '0.048' : '0.044';
Branch: 1 branch
BranchTrueFalseTotal
-f 'dynamic-prereqs.yml' ? : 0 0 0
37 }
38  
39 0 ▶sub prereqs_for {
Subroutine prereqs_for: not called CC=3 SCAR=24.8
Pod undocumented
40 0 my ($meta, $phase, $type, $module, $default) = @_;
41 0 ▶ return $meta->effective_prereqs->requirements_for($phase, $type)->requirements_for_module($module) // $default // 0;
Condition0%0/5
($meta->effective_prereqs->requirements_for($phase, $type)->requirements_for_module($module) // $default) // 0
l!l
00
$meta->effective_prereqs->requirements_for($phase, $type)->requirements_for_module($module) // $default
l!l&&r!l&&!r
000
MC/DC0%0/2
($meta->effective_prereqs->requirements_for($phase, $type)->requirements_for_module($module) // $default) // 0
$meta->effective_prereqs->requirements_for($phase, $type)->requirements_for_module($module) $default
Truth table0%0/3
A // B
A= $meta->effective_prereqs->requirements_for($phase, $type)->requirements_for_module($module)B= $default
ABresult
1X1
011
000
42 }
43  
44 0 ▶sub uptodate {
Subroutine uptodate: not called CC=5 SCAR=34.0
Pod undocumented
45 0 my ($destination, @source) = @_;
46 0 ▶ return if not -e $destination;
Branch: 1 branch
BranchTrueFalseTotal
unless -e $destination 0 0 0
47 0 ▶ for my $source (grep { defined && -e } @source) {
Condition0%0/3
defined $_ && -e $_
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ && -e $_
defined $_ -e $_
Truth table0%0/3
A && B
A= defined $_B= -e $_
ABresult
0X0
100
111
48 0 ▶ return if -M $destination > -M $source;
Branch: 1 branch
BranchTrueFalseTotal
if -M $destination > -M $source 0 0 0
49 }
50 0 return 1;
51 }
52  
53 0 ▶sub distfilename {
Subroutine distfilename: not called CC=1 SCAR=6.9
Pod undocumented
54 0 my $distname = shift;
55 0 return catfile('lib', split /-/, $distname) . '.pm';
56 }
57  
58 0 ▶sub generate_readme {
Subroutine generate_readme: not called CC=2 SCAR=17.9
Pod undocumented
59 0 my $distname = shift;
60 0 my $filename = distfilename($distname);
61 0 ▶ die "Main module file $filename doesn't exist\n" if not -f $filename;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $filename 0 0 0
62 0 my $parser = Pod::Simple::Text->new;
63 0 $parser->output_string( \my $content );
64 0 $parser->parse_characters(1);
65 0 $parser->parse_file($filename);
66 0 return decode_utf8($content);
67 }
68  
69 0 ▶sub load_jsonyaml {
Subroutine load_jsonyaml: not called CC=1 SCAR=6.9
Pod undocumented
70 0 my $file = shift;
71 0 require Parse::CPAN::Meta;
72 0 return Parse::CPAN::Meta->load_file($file);
73 }
74  
75 0 ▶sub load_mergedata {
Subroutine load_mergedata: not called CC=3 SCAR=24.8
Pod undocumented
76 0 my $mergefile = shift;
77 0 ▶ if (defined $mergefile and -r $mergefile) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mergefile and -r $mergefile) 0 0 0
Condition0%0/3
defined $mergefile and -r $mergefile
!ll&&!rl&&r
000
MC/DC0%0/2
defined $mergefile and -r $mergefile
defined $mergefile -r $mergefile
Truth table0%0/3
A and B
A= defined $mergefileB= -r $mergefile
ABresult
0X0
100
111
78 0 return load_jsonyaml($mergefile);
79 }
80 0 return;
81 }
82  
83 0 ▶sub distname {
Subroutine distname: not called CC=2 SCAR=17.9
Pod undocumented
84 0 my $extra = shift;
85 0 ▶ return delete $extra->{name} if defined $extra->{name};
Branch: 1 branch
BranchTrueFalseTotal
if defined $extra->{"name"} 0 0 0
86 0 return basename(rel2abs('.')) =~ s/ (?: ^ (?: perl|p5 ) - | [\-\.]pm $ )//xr;
87 }
88  
89 0 ▶sub detect_license {
Subroutine detect_license: not called CC=11 SCAR=48.8
Pod undocumented
90 0 my ($data, $filename, $authors, $mergedata) = @_;
91 0 ▶ if ($mergedata->{license} && @{$mergedata->{license}} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mergedata->{"license"} and @{$mergedata->{"license"};} == 1) 0 0 0
Condition0%0/3
$mergedata->{"license"} and @{$mergedata->{"license"};} == 1
!ll&&!rl&&r
000
MC/DC0%0/2
$mergedata->{"license"} and @{$mergedata->{"license"};} == 1
$mergedata->{"license"} @{$mergedata->{"license"};} == 1
Truth table0%0/3
A and B
A= $mergedata->{"license"}B= @{$mergedata->{"license"};} == 1
ABresult
0X0
100
111
92 0 require Software::LicenseUtils;
93 0 Software::LicenseUtils->VERSION(0.103014);
94 0 ▶ my $spec_version = $mergedata->{'meta-spec'} && $mergedata->{'meta-spec'}{version} ? $mergedata->{'meta-spec'}{version} : 2;
Branch: 1 branch
BranchTrueFalseTotal
$mergedata->{'meta-spec'} && $mergedata->{'meta-spec'}{'version'} ? : 0 0 0
Condition0%0/3
$mergedata->{"meta-spec"} and $mergedata->{"meta-spec"}{"version"}
!ll&&!rl&&r
000
MC/DC0%0/2
$mergedata->{"meta-spec"} and $mergedata->{"meta-spec"}{"version"}
$mergedata->{"meta-spec"} $mergedata->{"meta-spec"}{"version"}
Truth table0%0/3
A and B
A= $mergedata->{"meta-spec"}B= $mergedata->{"meta-spec"}{"version"}
ABresult
0X0
100
111
95 0 my @guess = Software::LicenseUtils->guess_license_from_meta_key($mergedata->{license}[0], $spec_version);
96 0 ▶ die "Couldn't parse license from metamerge: @guess\n" if @guess > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @guess > 1 0 0 0
97 0 ▶ if (@guess) {
Branch: 1 branch
BranchTrueFalseTotal
if (@guess) 0 0 0
98 0 my $class = $guess[0];
99 0 require_module($class);
100 0 return $class->new({holder => join(', ', @{$authors})});
101 }
102 }
103 0 my (@license_sections) = grep { /licen[cs]e|licensing|copyright|legal|authors?\b/i } $data->pod_inside;
104 0 for my $license_section (@license_sections) {
105 0 ▶ next unless defined ( my $license_pod = $data->pod($license_section) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $license_pod = $data->pod($license_section)) 0 0 0
106 0 require Software::LicenseUtils;
107 0 Software::LicenseUtils->VERSION(0.103014);
108 0 my $content = "=head1 LICENSE\n" . $license_pod;
109 0 my @guess = Software::LicenseUtils->guess_license_from_pod($content);
110 0 ▶ next if not @guess;
Branch: 1 branch
BranchTrueFalseTotal
unless @guess 0 0 0
111 0 ▶ die "Couldn't parse license from $license_section in $filename: @guess\n" if @guess != 1;
Branch: 1 branch
BranchTrueFalseTotal
if @guess != 1 0 0 0
112 0 my $class = $guess[0];
113 0 my ($year) = $license_pod =~ /.*? copyright .*? ([\d\-]+)/;
114 0 require_module($class);
115 0 return $class->new({holder => join(', ', @{$authors}), year => $year});
116 }
117 0 die "No license found in $filename\n";
118 }
119  
120 0 ▶sub get_changes {
Subroutine get_changes: not called CC=4 SCAR=30.0
Pod undocumented
121 0 my $self = shift;
122 0 my $version = quotemeta $self->meta->version;
123 0 ▶ open my $changes, '<:raw', 'Changes' or die "Couldn't open Changes file";
Branch: 1 branch
BranchTrueFalseTotal
open my $changes, "<:raw", "Changes" or die "Couldn't open Changes file" 0 0 0
124 0 my (undef, @content) = grep { / ^ $version (?:-TRIAL)? (?:\s+|$) /x ... /^\S/ } <$changes>;
125 0 ▶ pop @content while @content && $content[-1] =~ / ^ (?: \S | \s* $ ) /x;
Branch: 1 branch
BranchTrueFalseTotal
@content and $content[-1] =~ / ^ (?: \S | \s* $ ) /ux and do { pop @content } 0 0 0
Condition0%0/3
@content and $content[-1] =~ / ^ (?: \S | \s* $ ) /ux
!ll&&!rl&&r
000
MC/DC0%0/2
@content and $content[-1] =~ / ^ (?: \S | \s* $ ) /ux
@content $content[-1] =~ / ^ (?: \S | \s* $ ) /ux
Truth table0%0/3
A and B
A= @contentB= $content[-1] =~ / ^ (?: \S | \s* $ ) /ux
ABresult
0X0
100
111
126 0 return @content;
127 }
128  
129 0 ▶sub preflight_check {
Subroutine preflight_check: not called CC=8 SCAR=42.8
Pod undocumented
130 0 my ($self, %opts) = @_;
131  
132 0 ▶ die "Changes appears to be empty\n" if not $self->get_changes;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->get_changes 0 0 0
133  
134 0 my $meta_version = $self->{meta}->version;
135 0 ▶ die "Version is still zero\n" if $meta_version eq '0.000';
Branch: 1 branch
BranchTrueFalseTotal
if $meta_version eq "0.000" 0 0 0
136  
137 0 ▶ die "Abstract is not set\n" if $self->{meta}->abstract eq 'INSERT YOUR ABSTRACT HERE';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"meta"}->abstract eq "INSERT YOUR ABSTRACT HERE" 0 0 0
138  
139 0 ▶ if ($opts{tag}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"tag"}) 0 0 0
140 0 require Git::Wrapper;
141 0 my $git = Git::Wrapper->new('.');
142  
143 0 ▶ die "Dirty state in repository\n" if $git->status->is_dirty;
Branch: 1 branch
BranchTrueFalseTotal
if $git->status->is_dirty 0 0 0
144 0 ▶ die "Tag v$meta_version already exists\n" if eval { $git->rev_parse({ quiet => 1, verify => 1}, "v$meta_version") };
Branch: 1 branch
BranchTrueFalseTotal
if eval { do { $git->rev_parse({"quiet", 1, "verify", 1}, "v$meta_version") } } 0 0 0
145 }
146  
147 0 my $module_name = $self->{meta}->name =~ s/-/::/gr;
148 0 my $detected_version = $self->{data}->version($module_name);
149 0 ▶ die sprintf "Version mismatch between module and meta, did you forgot to run regenerate? (%s versus %s)\n", $detected_version, $meta_version if $detected_version != $meta_version;
Branch: 1 branch
BranchTrueFalseTotal
if $detected_version != $meta_version 0 0 0
150 }
151  
152 0 ▶sub scan_files {
Subroutine scan_files: not called CC=3 SCAR=24.8
Pod undocumented
153 0 my ($files, $omit, %extra_args) = @_;
154 0 my $combined = CPAN::Meta::Requirements->new;
155 0 require Perl::PrereqScanner;
156 0 my $scanner = Perl::PrereqScanner->new(\%extra_args);
157 0 for my $file (@{$files}) {
158 0 my $prereqs = $scanner->scan_file($file);
159 0 $combined->add_requirements($prereqs);
160 }
161 0 $combined->clear_requirement($_) for @{$omit};
162 0 return $combined
163 }
164  
165 0 ▶sub _scan_prereqs {
Subroutine _scan_prereqs: not called CC=5 SCAR=34.0
166 0 my ($omit, %opts) = @_;
167 0 my (@runtime_files, @test_files, @planner_files);
168 0 ▶ File::Find::find(sub { push @runtime_files, $File::Find::name if -f && /\.pm$/ }, 'lib') if -d 'lib';
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
if -d "lib" 0 0 0
if -f $_ and /\.pm$/u 0 0 0
Condition0%0/3
-f $_ and /\.pm$/u
!ll&&!rl&&r
000
MC/DC0%0/2
-f $_ and /\.pm$/u
-f $_ /\.pm$/u
Truth table0%0/3
A and B
A= -f $_B= /\.pm$/u
ABresult
0X0
100
111
169 0 ▶ File::Find::find(sub { push @runtime_files, $File::Find::name if -f }, 'script') if -d 'script';
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 2 branches
BranchTrueFalseTotal
if -d "script" 0 0 0
if -f $_ 0 0 0
170 0 ▶ File::Find::find(sub { push @test_files, $File::Find::name if -f && /\.(t|pm)$/ }, 't') if -d 't';
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
if -d "t" 0 0 0
if -f $_ and /\.(t|pm)$/u 0 0 0
Condition0%0/3
-f $_ and /\.(t|pm)$/u
!ll&&!rl&&r
000
MC/DC0%0/2
-f $_ and /\.(t|pm)$/u
-f $_ /\.(t|pm)$/u
Truth table0%0/3
A and B
A= -f $_B= /\.(t|pm)$/u
ABresult
0X0
100
111
171  
172 0 my $runtime = scan_files(\@runtime_files, $omit);
173 0 my $test = scan_files(\@test_files, $omit);
174  
175 0 my %prereqs = (
176 runtime => { requires => $runtime->as_string_hash },
177 test => { requires => $test->as_string_hash },
178 );
179  
180 0 ▶ if (-d 'planner') {
Branch: 1 branch
BranchTrueFalseTotal
if (-d 'planner') { } 0 0 0
181 0 ▶ File::Find::find(sub { push @planner_files, $File::Find::name if -f && /\.pl$/ }, 'planner');
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
if -f $_ and /\.pl$/u 0 0 0
Condition0%0/3
-f $_ and /\.pl$/u
!ll&&!rl&&r
000
MC/DC0%0/2
-f $_ and /\.pl$/u
-f $_ /\.pl$/u
Truth table0%0/3
A and B
A= -f $_B= /\.pl$/u
ABresult
0X0
100
111
182 0 require Perl::PrereqScanner::Scanner::DistBuild;
183 0 my $configure = scan_files(\@planner_files, ['strict', 'warnings', @{$omit}], extra_scanners => [ 'DistBuild' ]);
184 0 $configure->add_minimum('Dist::Build' => '0.003');
185 0 $prereqs{configure} = { requires => $configure->as_string_hash };
186 } else {
187 0 $prereqs{configure} = { requires => { 'Module::Build::Tiny' => mbt_version() } };
188 }
189  
190 0 my $prereqs = CPAN::Meta::Prereqs->new(\%prereqs);
191 0 require CPAN::Meta::Prereqs::Filter;
192 0 return CPAN::Meta::Prereqs::Filter::filter_prereqs($prereqs, %opts);
193 }
194  
195  
196 0 ▶sub scan_prereqs {
Subroutine scan_prereqs: not called CC=2 SCAR=17.9
Pod undocumented
197 0 my ($self, %opts) = @_;
198 0 ▶ my @omit = (@{ $opts{omit} // [] }, keys %{ $self->{meta}->provides });
Condition0%0/2
$opts{"omit"} // []
l!l
00
MC/DC0%0/1
$opts{"omit"} // []
$opts{"omit"}
Truth table0%0/2
A
A= $opts{"omit"}
Aresult
11
00
199 0 return _scan_prereqs(\@omit, %opts);
200 }
201  
202 0 ▶sub load_prereqs {
Subroutine load_prereqs: not called CC=7 SCAR=40.3
Pod undocumented
203 0 my ($provides, %opts) = @_;
204 0 my @prereqs;
205 0 ▶ if (-f 'prereqs.json') {
Branch: 1 branch
BranchTrueFalseTotal
if (-f "prereqs.json") 0 0 0
206 0 push @prereqs, load_jsonyaml('prereqs.json');
207 }
208 0 ▶ if (-f 'prereqs.yml') {
Branch: 1 branch
BranchTrueFalseTotal
if (-f "prereqs.yml") 0 0 0
209 0 push @prereqs, load_jsonyaml('prereqs.yml');
210 }
211 0 ▶ if (-f 'cpanfile') {
Branch: 1 branch
BranchTrueFalseTotal
if (-f "cpanfile") 0 0 0
212 0 require Module::CPANfile;
213 0 push @prereqs, Module::CPANfile->load('cpanfile')->prereq_specs;
214 }
215 0 ▶ if ($opts{scan}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"scan"}) 0 0 0
216 0 push @prereqs, _scan_prereqs([ keys %{$provides} ])->as_string_hash;
217 }
218  
219 0 ▶ if (@prereqs == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (@prereqs == 1) { } 0 0 0
elsif (@prereqs == 0) { } 0 0 0
220 0 return $prereqs[0];
221 }
222 elsif (@prereqs == 0) {
223 0 return {};
224 }
225 else {
226 0 @prereqs = map { CPAN::Meta::Prereqs->new($_) } @prereqs;
227 0 my $prereqs = $prereqs[0]->with_merged_prereqs([ @prereqs[1..$#prereqs] ]);
228 0 $prereqs->as_string_hash;
229 }
230 }
231  
232 0 ▶sub new {
Subroutine new: not called CC=48 SCAR=77.6
Pod undocumented
233 0 my ($class, %opts) = @_;
234 0 ▶ my $mergefile = $opts{mergefile} // (grep { -f } qw/metamerge.json metamerge.yml/)[0];
Condition0%0/3
$opts{"mergefile"} // (grep {-f $_;} "metamerge.json", "metamerge.yml")[0]
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts{"mergefile"} // (grep {-f $_;} "metamerge.json", "metamerge.yml")[0]
$opts{"mergefile"} (grep {-f $_;} "metamerge.json", "metamerge.yml")[0]
Truth table0%0/3
A // B
A= $opts{"mergefile"}B= (grep {-f $_;} "metamerge.json", "metamerge.yml")[0]
ABresult
1X1
011
000
235 0 ▶ my $mergedata = load_mergedata($mergefile) // {};
Condition0%0/2
load_mergedata($mergefile) // {}
l!l
00
MC/DC0%0/1
load_mergedata($mergefile) // {}
load_mergedata($mergefile)
Truth table0%0/2
A
A= load_mergedata($mergefile)
Aresult
11
00
236 0 my $distname = distname($mergedata);
237 0 my $filename = distfilename($distname);
238 0 my $podname = $filename =~ s/\.pm$/.pod/r;
239  
240 0 ▶ my $data = Module::Metadata->new_from_file($filename, collect_pod => 1, decode_pod => 1) or die "Couldn't analyse $filename: $!";
Branch: 1 branch
BranchTrueFalseTotal
my $data = "Module::Metadata"->new_from_file($filename, "collect_pod", 1, "decode_pod", 1) or die "Couldn't analyse ${filename}: $!" 0 0 0
241 0 ▶ my $pod_data = -e $podname && Module::Metadata->new_from_file($podname, collect_pod => 1, decode_pod => 1) // $data;
Condition0%0/6
-e $podname && "Module::Metadata"->new_from_file($podname, "collect_pod", 1, "decode_pod", 1) // $data
l!l&&r!l&&!r
000
-e $podname and "Module::Metadata"->new_from_file($podname, "collect_pod", 1, "decode_pod", 1)
!ll&&!rl&&r
000
MC/DC0%0/3
-e $podname && "Module::Metadata"->new_from_file($podname, "collect_pod", 1, "decode_pod", 1) // $data
-e $podname "Module::Metadata"->new_from_file($podname, "collect_pod", 1, "decode_pod", 1) $data
Truth table0%0/5
A and B // C
A= -e $podnameB= "Module::Metadata"->new_from_file($podname, "collect_pod", 1, "decode_pod", 1)C= $data
ABCresult
11X1
0X11
1011
0X00
1000
242 0 ▶ my @authors = map { s/E<([^>]+)>/e2char($1)/ge; m/ \A \s* (.+?) \s* \z /x } grep { /\S/ } split /\n/, $pod_data->pod('AUTHOR') // $pod_data->pod('AUTHORS') // '' or warn "Could not parse any authors from `=head1 AUTHOR` in $filename";
Branch: 1 branch
BranchTrueFalseTotal
my(@authors) = map({s/E<([^>]+)>/e2char($1);/egu; / \A \s* (.+?) \s* \z /ux;} grep({/\S/u;} split(/\n/u, ($pod_data->pod("AUTHOR") // $pod_data->pod("AUTHORS")) // "", 0))) or warn "Could not parse any authors from `=head1 AUTHOR` in $filename" 0 0 0
Condition0%0/5
($pod_data->pod("AUTHOR") // $pod_data->pod("AUTHORS")) // ""
l!l
00
$pod_data->pod("AUTHOR") // $pod_data->pod("AUTHORS")
l!l&&r!l&&!r
000
MC/DC0%0/2
($pod_data->pod("AUTHOR") // $pod_data->pod("AUTHORS")) // ""
$pod_data->pod("AUTHOR") $pod_data->pod("AUTHORS")
Truth table0%0/3
A // B
A= $pod_data->pod("AUTHOR")B= $pod_data->pod("AUTHORS")
ABresult
1X1
011
000
243 0 my $license = detect_license($pod_data, $filename, \@authors, $mergedata);
244  
245 0 ▶ my $load_meta = !%{ $opts{regenerate} // {} } && uptodate('META.json', 'cpanfile', 'prereqs.json', 'prereqs.yml', $mergefile);
Condition0%0/5
!%{$opts{'regenerate'} // {};} && uptodate('META.json', 'cpanfile', 'prereqs.json', 'prereqs.yml', $mergefile)
!ll&&!rl&&r
000
$opts{"regenerate"} // {}
l!l
00
MC/DC0%0/2
!%{$opts{'regenerate'} // {};} && uptodate('META.json', 'cpanfile', 'prereqs.json', 'prereqs.yml', $mergefile)
!%{$opts{'regenerate'} // {};} uptodate('META.json', 'cpanfile', 'prereqs.json', 'prereqs.yml', $mergefile)
MC/DC0%0/1
$opts{"regenerate"} // {}
$opts{"regenerate"}
Truth table0%0/3
not(A) && B
A= !%{$opts{'regenerate'} // {};}B= uptodate('META.json', 'cpanfile', 'prereqs.json', 'prereqs.yml', $mergefile)
ABresult
0X0
100
111
Truth table0%0/2
A
A= $opts{"regenerate"}
Aresult
11
00
246  
247 0 ▶ my $mode = -d 'planner' ? 'DB' : 'MBT';
Branch: 1 branch
BranchTrueFalseTotal
-d 'planner' ? : 0 0 0
248 0 ▶ my $meta = $load_meta ? CPAN::Meta->load_file('META.json', { lazy_validation => 0 }) : do {
Branch: 1 branch
BranchTrueFalseTotal
$load_meta ? : 0 0 0
249 0 ▶ my ($abstract) = ($pod_data->pod('NAME') // '') =~ / \A \s+ \S+ \s? - \s? (.+?) \s* \z /x or warn "Could not parse abstract from `=head1 NAME` in $filename";
Branch: 1 branch
BranchTrueFalseTotal
my($abstract) = ($pod_data->pod("NAME") // "") =~ / \A \s+ \S+ \s? - \s? (.+?) \s* \z /ux or warn "Could not parse abstract from `=head1 NAME` in $filename" 0 0 0
Condition0%0/2
$pod_data->pod("NAME") // ""
l!l
00
MC/DC0%0/1
$pod_data->pod("NAME") // ""
$pod_data->pod("NAME")
Truth table0%0/2
A
A= $pod_data->pod("NAME")
Aresult
11
00
250 0 ▶ my $version = $data->version($data->name) // die "Cannot parse \$VERSION from $filename";
Condition0%0/2
$data->version($data->name) // die("Cannot parse \$VERSION from $filename")
l!l
00
MC/DC0%0/1
$data->version($data->name) // die("Cannot parse \$VERSION from $filename")
$data->version($data->name)
Truth table0%0/2
A
A= $data->version($data->name)
Aresult
11
00
251  
252 0 my $provides = Module::Metadata->provides(version => 2, dir => 'lib');
253 0 my $prereqs = load_prereqs($provides, %opts);
254 0 ▶ if ($mode eq 'MBT') {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode eq 'MBT') { } 0 0 0
255 0 ▶ $prereqs->{configure}{requires}{'Module::Build::Tiny'} //= mbt_version();
Condition0%0/3
$prereqs->{"configure"}{"requires"}{"Module::Build::Tiny"} //= mbt_version()
l!l&&r!l&&!r
000
MC/DC0%0/2
$prereqs->{"configure"}{"requires"}{"Module::Build::Tiny"} //= mbt_version()
$prereqs->{"configure"}{"requires"}{"Module::Build::Tiny"} mbt_version()
Truth table0%0/3
A //= B
A= $prereqs->{"configure"}{"requires"}{"Module::Build::Tiny"}B= mbt_version()
ABresult
1X1
011
000
256 } else {
257 0 ▶ $prereqs->{configure}{requires}{'Dist::Build'} //= '0.003';
Condition0%0/2
$prereqs->{"configure"}{"requires"}{"Dist::Build"} //= "0.003"
l!l
00
MC/DC0%0/1
$prereqs->{"configure"}{"requires"}{"Dist::Build"} //= "0.003"
$prereqs->{"configure"}{"requires"}{"Dist::Build"}
Truth table0%0/2
A
A= $prereqs->{"configure"}{"requires"}{"Dist::Build"}
Aresult
11
00
258 }
259 0 ▶ $prereqs->{develop}{requires}{'App::ModuleBuildTiny'} //= $VERSION;
Condition0%0/3
$prereqs->{"develop"}{"requires"}{"App::ModuleBuildTiny"} //= $VERSION
l!l&&r!l&&!r
000
MC/DC0%0/2
$prereqs->{"develop"}{"requires"}{"App::ModuleBuildTiny"} //= $VERSION
$prereqs->{"develop"}{"requires"}{"App::ModuleBuildTiny"} $VERSION
Truth table0%0/3
A //= B
A= $prereqs->{"develop"}{"requires"}{"App::ModuleBuildTiny"}B= $VERSION
ABresult
1X1
011
000
260 0 my %resources = $class->generate_resources(%opts);
261  
262 my $metahash = {
263 name => $distname,
264 version => $version->stringify,
265 author => \@authors,
266 abstract => $abstract,
267 dynamic_config => 0,
268 license => [ $license->meta2_name ],
269 prereqs => $prereqs,
270 0 ▶ release_status => $opts{trial} // $version =~ /_/ ? 'testing' : 'stable',
Branch: 1 branch
BranchTrueFalseTotal
$opts{'trial'} // $version =~ /_/u ? : 0 0 0
Condition0%0/3
$opts{"trial"} // $version =~ /_/u
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts{"trial"} // $version =~ /_/u
$opts{"trial"} $version =~ /_/u
Truth table0%0/3
A // B
A= $opts{"trial"}B= $version =~ /_/u
ABresult
1X1
011
000
271 generated_by => "App::ModuleBuildTiny version $VERSION",
272 'meta-spec' => {
273 version => 2,
274 url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec'
275 },
276 (resources => \%resources) x!! %resources,
277 x_spdx_expression => $license->spdx_expression,
278 x_generated_by_perl => "$^V",
279 };
280  
281 0 ▶ if (-e 'dynamic-prereqs.yml') {
Branch: 1 branch
BranchTrueFalseTotal
if (-e "dynamic-prereqs.yml") 0 0 0
282 0 my $dynamic_prereqs = load_jsonyaml('dynamic-prereqs.yml');
283 0 for my $expression (@{ $dynamic_prereqs->{expressions}}) {
284 0 ▶ $expression->{condition} = [ shellwords($expression->{condition}) ] unless ref $expression->{condition};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $expression->{"condition"} 0 0 0
285 0 ▶ if (not ref $expression->{prereqs}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $expression->{"prereqs"}) 0 0 0
286 0 my ($module, $version) = shellwords($expression->{prereqs});
287 0 ▶ $version //= '0';
Condition0%0/2
$version //= 0
l!l
00
MC/DC0%0/1
$version //= 0
$version
Truth table0%0/2
A
A= $version
Aresult
11
00
288 0 $expression->{prereqs} = { $module => $version };
289 }
290 }
291 0 $metahash->{x_dynamic_prereqs} = $dynamic_prereqs;
292 }
293 0 ▶ if (%{$mergedata}) {
Branch: 1 branch
BranchTrueFalseTotal
if (%{$mergedata;}) 0 0 0
294 0 require CPAN::Meta::Merge;
295 0 $metahash = CPAN::Meta::Merge->new(default_version => '2')->merge($metahash, $mergedata);
296 }
297 0 ▶ if ($metahash->{x_dynamic_prereqs}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($metahash->{"x_dynamic_prereqs"}) 0 0 0
298 0 $metahash->{dynamic_config} = 1;
299 0 ▶ $metahash->{prereqs}{configure}{requires}{'CPAN::Requirements::Dynamic'} //= '0.002' if $mode eq 'MBT';
Branch: 1 branch
BranchTrueFalseTotal
if $mode eq "MBT" 0 0 0
Condition0%0/2
$metahash->{"prereqs"}{"configure"}{"requires"}{"CPAN::Requirements::Dynamic"} //= "0.002"
l!l
00
MC/DC0%0/1
$metahash->{"prereqs"}{"configure"}{"requires"}{"CPAN::Requirements::Dynamic"} //= "0.002"
$metahash->{"prereqs"}{"configure"}{"requires"}{"CPAN::Requirements::Dynamic"}
Truth table0%0/2
A
A= $metahash->{"prereqs"}{"configure"}{"requires"}{"CPAN::Requirements::Dynamic"}
Aresult
11
00
300 }
301  
302 # this avoids a long-standing CPAN.pm bug that incorrectly merges runtime and
303 # "build" (build+test) requirements by ensuring requirements stay unified
304 # across all three phases
305 0 require CPAN::Meta::Prereqs::Filter;
306 0 my $filtered = CPAN::Meta::Prereqs::Filter::filter_prereqs(CPAN::Meta::Prereqs->new($metahash->{prereqs}), sanitize => 1);
307 0 my $merged_prereqs = $filtered->merged_requirements([qw/runtime build test/], ['requires']);
308 0 my %seen;
309 0 for my $phase (qw/runtime build test/) {
310 0 my $requirements = $filtered->requirements_for($phase, 'requires');
311 0 for my $module ($requirements->required_modules) {
312 0 $requirements->clear_requirement($module);
313 0 ▶ next if $seen{$module}++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen{$module}++ 0 0 0
314 0 my $module_requirement = $merged_prereqs->requirements_for_module($module);
315 0 $requirements->add_string_requirement($module => $module_requirement);
316 }
317 }
318 0 $metahash->{prereqs} = $filtered->as_string_hash;
319  
320 0 ▶ $metahash->{provides} //= $provides if not $metahash->{no_index};
Branch: 1 branch
BranchTrueFalseTotal
unless $metahash->{"no_index"} 0 0 0
Condition0%0/3
$metahash->{"provides"} //= $provides
l!l&&r!l&&!r
000
MC/DC0%0/2
$metahash->{"provides"} //= $provides
$metahash->{"provides"} $provides
Truth table0%0/3
A //= B
A= $metahash->{"provides"}B= $provides
ABresult
1X1
011
000
321 0 CPAN::Meta->create($metahash, { lazy_validation => 0 });
322 };
323  
324 0 my %files;
325 0 ▶ if (not $opts{regenerate}{MANIFEST} and -r 'MANIFEST') {
Branch: 1 branch
BranchTrueFalseTotal
if (not $opts{'regenerate'}{'MANIFEST'} and -r 'MANIFEST') { } 0 0 0
Condition0%0/3
not $opts{"regenerate"}{"MANIFEST"} and -r "MANIFEST"
!ll&&!rl&&r
000
MC/DC0%0/2
not $opts{"regenerate"}{"MANIFEST"} and -r "MANIFEST"
not $opts{"regenerate"}{"MANIFEST"} -r "MANIFEST"
Truth table0%0/3
not(A) and B
A= not $opts{"regenerate"}{"MANIFEST"}B= -r "MANIFEST"
ABresult
0X0
100
111
326 0 %files = %{ maniread() };
327 }
328 else {
329 0 my $maniskip = maniskip;
330 0 %files = %{ manifind() };
331 0 delete $files{$_} for grep { $maniskip->($_) } keys %files;
332 }
333 0 delete $files{$_} for keys %{ $opts{regenerate} };
334
335 0 my $dist_name = $meta->name;
336 0 ▶ $files{'Build.PL'} //= do {
Condition0%0/3
$files{"Build.PL"} //= do { my $minimum_perl = prereqs_for($meta, ("runtime", "requires", "perl", "5.008")); my $header = "# This Build.PL for $dist_name was generated by mbtiny $VERSION."; if ($mode eq "MBT") { my $minimum_mbt = prereqs_for($meta, ("configure", "requires", "Module::Build::Tiny")); "$header\nuse $minimum_perl;\nuse Module::Build::Tiny $minimum_mbt;\nBuild_PL();\n"; } else { my $minimum_db = prereqs_for($meta, ("configure", "requires", "Dist::Build")); "$header\nuse $minimum_perl;\nuse Dist::Build $minimum_db;\nBuild_PL(\\\@ARGV, \\%ENV);\n"; } }
l!l&&r!l&&!r
000
MC/DC0%0/2
$files{"Build.PL"} //= do { my $minimum_perl = prereqs_for($meta, ("runtime", "requires", "perl", "5.008")); my $header = "# This Build.PL for $dist_name was generated by mbtiny $VERSION."; if ($mode eq "MBT") { my $minimum_mbt = prereqs_for($meta, ("configure", "requires", "Module::Build::Tiny")); "$header\nuse $minimum_perl;\nuse Module::Build::Tiny $minimum_mbt;\nBuild_PL();\n"; } else { my $minimum_db = prereqs_for($meta, ("configure", "requires", "Dist::Build")); "$header\nuse $minimum_perl;\nuse Dist::Build $minimum_db;\nBuild_PL(\\\@ARGV, \\%ENV);\n"; } }
$files{"Build.PL"} do { my $minimum_perl = prereqs_for($meta, ("runtime", "requires", "perl", "5.008")); my $header = "# This Build.PL for $dist_name was generated by mbtiny $VERSION."; if ($mode eq "MBT") { my $minimum_mbt = prereqs_for($meta, ("configure", "requires", "Module::Build::Tiny")); "$header\nuse $minimum_perl;\nuse Module::Build::Tiny $minimum_mbt;\nBuild_PL();\n"; } else { my $minimum_db = prereqs_for($meta, ("configure", "requires", "Dist::Build")); "$header\nuse $minimum_perl;\nuse Dist::Build $minimum_db;\nBuild_PL(\\\@ARGV, \\%ENV);\n"; } }
Truth table0%0/3
A //= B
A= $files{"Build.PL"}B= do { my $minimum_perl = prereqs_for($meta, ("runtime", "requires", "perl", "5.008")); my $header = "# This Build.PL for $dist_name was generated by mbtiny $VERSION."; if ($mode eq "MBT") { my $minimum_mbt = prereqs_for($meta, ("configure", "requires", "Module::Build::Tiny")); "$header\nuse $minimum_perl;\nuse Module::Build::Tiny $minimum_mbt;\nBuild_PL();\n"; } else { my $minimum_db = prereqs_for($meta, ("configure", "requires", "Dist::Build")); "$header\nuse $minimum_perl;\nuse Dist::Build $minimum_db;\nBuild_PL(\\\@ARGV, \\%ENV);\n"; } }
ABresult
1X1
011
000
337 0 my $minimum_perl = prereqs_for($meta, qw/runtime requires perl 5.008/);
338 0 my $header = "# This Build.PL for $dist_name was generated by mbtiny $VERSION.";
339 0 ▶ if ($mode eq 'MBT') {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode eq 'MBT') { } 0 0 0
340 0 my $minimum_mbt = prereqs_for($meta, qw/configure requires Module::Build::Tiny/);
341 0 "$header\nuse $minimum_perl;\nuse Module::Build::Tiny $minimum_mbt;\nBuild_PL();\n";
342 } else {
343 0 my $minimum_db = prereqs_for($meta, qw/configure requires Dist::Build/);
344 0 "$header\nuse $minimum_perl;\nuse Dist::Build $minimum_db;\nBuild_PL(\\\@ARGV, \\\%ENV);\n";
345 }
346 };
347 {
348 0 local $ENV{CPAN_META_JSON_BACKEND} = JSON::MaybeXS::JSON();
349 0 ▶ $files{'META.json'} //= $meta->as_string;
Condition0%0/3
$files{"META.json"} //= $meta->as_string
l!l&&r!l&&!r
000
MC/DC0%0/2
$files{"META.json"} //= $meta->as_string
$files{"META.json"} $meta->as_string
Truth table0%0/3
A //= B
A= $files{"META.json"}B= $meta->as_string
ABresult
1X1
011
000
350 0 ▶ $files{'META.yml'} //= $meta->as_string({ version => 1.4 });
Condition0%0/3
$files{"META.yml"} //= $meta->as_string({"version", "1.4"})
l!l&&r!l&&!r
000
MC/DC0%0/2
$files{"META.yml"} //= $meta->as_string({"version", "1.4"})
$files{"META.yml"} $meta->as_string({"version", "1.4"})
Truth table0%0/3
A //= B
A= $files{"META.yml"}B= $meta->as_string({"version", "1.4"})
ABresult
1X1
011
000
351 }
352 0 ▶ $files{LICENSE} //= $license->fulltext;
Condition0%0/3
$files{"LICENSE"} //= $license->fulltext
l!l&&r!l&&!r
000
MC/DC0%0/2
$files{"LICENSE"} //= $license->fulltext
$files{"LICENSE"} $license->fulltext
Truth table0%0/3
A //= B
A= $files{"LICENSE"}B= $license->fulltext
ABresult
1X1
011
000
353 0 ▶ $files{README} //= generate_readme($dist_name);
Condition0%0/3
$files{"README"} //= generate_readme($dist_name)
l!l&&r!l&&!r
000
MC/DC0%0/2
$files{"README"} //= generate_readme($dist_name)
$files{"README"} generate_readme($dist_name)
Truth table0%0/3
A //= B
A= $files{"README"}B= generate_readme($dist_name)
ABresult
1X1
011
000
354 0 ▶ if ($opts{regenerate}{Changes}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"regenerate"}{"Changes"}) 0 0 0
355 0 my $time = strftime("%Y-%m-%d %H:%M:%S%z", localtime);
356 0 my $header = sprintf "%-9s %s\n", $meta->version, $time;
357 0 $files{Changes} = read_text('Changes') =~ s/(?<=\n\n)/$header/er;
358 }
359 # This must come last
360 0 ▶ $files{MANIFEST} //= join '', map { "$_\n" } sort keys %files;
Condition0%0/2
$files{"MANIFEST"} //= join("", map({"$_\n";} sort(keys %files)))
l!l
00
MC/DC0%0/1
$files{"MANIFEST"} //= join("", map({"$_\n";} sort(keys %files)))
$files{"MANIFEST"}
Truth table0%0/2
A
A= $files{"MANIFEST"}
Aresult
11
00
361  
362 0 return bless {
363 files => \%files,
364 meta => $meta,
365 license => $license,
366 data => $data,
367 }, $class
368 }
369  
370  
371 0 ▶sub generate_resources {
Subroutine generate_resources: not called CC=8 SCAR=42.8
Pod undocumented
372 0 my ($class, %opts) = @_;
373 0 my %result;
374  
375 0 ▶ if ($opts{add_repository}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"add_repository"}) 0 0 0
376 0 require Git::Wrapper;
377 0 my $git = Git::Wrapper->new('.');
378 0 my ($origin) = $git->remote('get-url' => 'origin');
379 0 ▶ if ($origin =~ m{https://github.com/([\w.-]+)/([\w.-]+).git}) {
Branch: 3 branches
BranchTrueFalseTotal
if ($origin =~ m[https://github.com/([\w.-]+)/([\w.-]+).git]u) { } 0 0 0
elsif ($origin =~ m[git\@github.com:([\w.-]+)/([\w.-]+).git]u) { } 0 0 0
elsif ($origin =~ m[^https?://]u) { } 0 0 0
380 $result{repository} = {
381 0 type => 'git',
382 web => "https://github.com/$1/$2",
383 url => $origin,
384 };
385 } elsif ($origin =~ m{git\@github.com:([\w.-]+)/([\w.-]+).git}) {
386 $result{repository} = {
387 0 type => 'git',
388 web => "https://github.com/$1/$2",
389 url => "https://github.com/$1/$2.git",
390 };
391 } elsif ($origin =~ m{^https?://}) {
392 $result{repository} = {
393 0 type => 'git',
394 url => $origin,
395 };
396 }
397 }
398  
399 0 ▶ if ($opts{add_bugtracker}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"add_bugtracker"}) 0 0 0
400 0 require Git::Wrapper;
401 0 my $git = Git::Wrapper->new('.');
402 0 my ($origin) = $git->remote('get-url' => 'origin');
403 0 ▶ if ($origin =~ m{https://github.com/([\w.-]+)/([\w.-]+).git}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($origin =~ m[https://github.com/([\w.-]+)/([\w.-]+).git]u) { } 0 0 0
elsif ($origin =~ m[git\@github.com:([\w.-]+)/([\w.-]+).git]u) { } 0 0 0
404 $result{bugtracker} = {
405 0 web => "https://github.com/$1/$2/issues",
406 };
407 } elsif ($origin =~ m{git\@github.com:([\w.-]+)/([\w.-]+).git}) {
408 $result{bugtracker} = {
409 0 web => "https://github.com/$1/$2/issues",
410 };
411 }
412 }
413 0 return %result;
414 }
415  
416 0 ▶sub write_dir {
Subroutine write_dir: not called CC=4 SCAR=30.0
Pod undocumented
417 0 my ($self, $dir, $verbose) = @_;
418 0 mkpath($dir, $verbose, oct '755');
419 0 my $files = $self->{files};
420 0 for my $filename (keys %{$files}) {
421 0 my $target = "$dir/$filename";
422 0 ▶ mkpath(dirname($target)) if not -d dirname($target);
Branch: 1 branch
BranchTrueFalseTotal
unless -d dirname($target) 0 0 0
423 0 ▶ if ($files->{$filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($files->{$filename}) { } 0 0 0
424 0 write_text($target, $files->{$filename});
425 }
426 else {
427 0 copy($filename, $target);
428 }
429 }
430 }
431  
432 0 ▶sub write_tarball {
Subroutine write_tarball: not called CC=2 SCAR=17.9
Pod undocumented
433 0 my ($self, $name) = @_;
434 0 require Archive::Tar;
435 0 my $arch = Archive::Tar->new;
436 0 for my $filename ($self->files) {
437 0 $arch->add_data($filename, $self->get_file($filename), { mode => oct '0644'} );
438 }
439 0 $arch->write($name, &Archive::Tar::COMPRESS_GZIP, $name =~ s/.tar.gz$//r);
440 0 return $name;
441 }
442  
443 0 ▶sub files {
Subroutine files: not called CC=1 SCAR=6.9
Pod undocumented
444 0 my $self = shift;
445 0 return keys %{ $self->{files} };
446 }
447  
448 0 ▶sub get_file {
Subroutine get_file: not called CC=3 SCAR=24.8
Pod undocumented
449 0 my ($self, $filename) = @_;
450 0 ▶ return if not exists $self->{files}{$filename};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"files"}{$filename} 0 0 0
451 0 my $raw = $self->{files}{$filename};
452 0 ▶ return $raw ? encode_utf8($raw) : read_binary($filename);
Branch: 1 branch
BranchTrueFalseTotal
$raw ? : 0 0 0
453 }
454  
455 0 ▶sub run {
Subroutine run: not called CC=12 SCAR=50.5
Pod undocumented
456 0 my ($self, %opts) = @_;
457 0 require File::Temp;
458 0 my $dir = File::Temp::tempdir(CLEANUP => 1);
459 0 $self->write_dir($dir, $opts{verbose});
460 0 local $CWD = $dir;
461 0 my $ret = !!1;
462 0 ▶ if ($opts{build}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{'build'}) { } 0 0 0
463 0 ▶ system $Config{perlpath}, 'Build.PL' and ($opts{allow_failure} or die "Could not run Build.PL");
Branch: 1 branch
BranchTrueFalseTotal
system $App::ModuleBuildTiny::Dist::Config{"perlpath"}, "Build.PL" and $opts{"allow_failure"} || die("Could not run Build.PL") 0 0 0
Condition0%0/5
system($App::ModuleBuildTiny::Dist::Config{'perlpath'}, 'Build.PL') && ($opts{'allow_failure'} || die('Could not run Build.PL'))
!ll&&!rl&&r
000
$opts{"allow_failure"} or die "Could not run Build.PL"
l!l
00
MC/DC0%0/2
system($App::ModuleBuildTiny::Dist::Config{'perlpath'}, 'Build.PL') && ($opts{'allow_failure'} || die('Could not run Build.PL'))
system($App::ModuleBuildTiny::Dist::Config{'perlpath'}, 'Build.PL') $opts{"allow_failure"}
Truth table0%0/3
A && B
A= system($App::ModuleBuildTiny::Dist::Config{'perlpath'}, 'Build.PL')B= $opts{"allow_failure"}
ABresult
0X0
100
111
464 0 ▶ system $Config{perlpath}, 'Build' and ($opts{allow_failure} or die "Could not run Build");
Branch: 1 branch
BranchTrueFalseTotal
system $App::ModuleBuildTiny::Dist::Config{"perlpath"}, "Build" and $opts{"allow_failure"} || die("Could not run Build") 0 0 0
Condition0%0/5
system($App::ModuleBuildTiny::Dist::Config{'perlpath'}, 'Build') && ($opts{'allow_failure'} || die('Could not run Build'))
!ll&&!rl&&r
000
$opts{"allow_failure"} or die "Could not run Build"
l!l
00
MC/DC0%0/2
system($App::ModuleBuildTiny::Dist::Config{'perlpath'}, 'Build') && ($opts{'allow_failure'} || die('Could not run Build'))
system($App::ModuleBuildTiny::Dist::Config{'perlpath'}, 'Build') $opts{"allow_failure"}
Truth table0%0/3
A && B
A= system($App::ModuleBuildTiny::Dist::Config{'perlpath'}, 'Build')B= $opts{"allow_failure"}
ABresult
0X0
100
111
465 0 my @extralib = map { rel2abs("blib/$_") } 'arch', 'lib';
466 0 local @PERL5LIB = (@extralib, @PERL5LIB);
467 0 local @PATH = (rel2abs(catdir('blib', 'script')), @PATH);
468 0 for my $command (@{ $opts{commands} }) {
469 0 ▶ say join ' ', @{$command} if $opts{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"verbose"} 0 0 0
470 0 ▶ $ret &&= not system @{$command};
Condition0%0/3
$ret &&= !system(@{$command;})
!ll&&!rl&&r
000
MC/DC0%0/2
$ret &&= !system(@{$command;})
$ret !system(@{$command;})
Truth table0%0/3
A &&= not(B)
A= $retB= !system(@{$command;})
ABresult
0X0
100
111
471 }
472 }
473 else {
474 0 for my $command (@{ $opts{commands} }) {
475 0 ▶ say join ' ', @{$command} if $opts{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"verbose"} 0 0 0
476 0 ▶ $ret &&= not system @{$command};
Condition0%0/3
$ret &&= !system(@{$command;})
!ll&&!rl&&r
000
MC/DC0%0/2
$ret &&= !system(@{$command;})
$ret !system(@{$command;})
Truth table0%0/3
A &&= not(B)
A= $retB= !system(@{$command;})
ABresult
0X0
100
111
477 }
478 }
479 0 return $ret;
480 }
481  
482 1 for my $method (qw/meta license/) {
483 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
484 0 ▶ *$method = sub { my $self = shift; return $self->{$method}; };
Subroutine __ANON__: not called CC=1 SCAR=2.6
485 }
486  
487 1 for my $method (qw/name version release_status/) {
488 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
489 0 ▶ *$method = sub { my $self = shift; return $self->{meta}->$method; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
490 3 }
491  
492 0 ▶sub fullname {
Subroutine fullname: not called CC=3 SCAR=24.8
Pod undocumented
493 0 my $self = shift;
494 0 ▶ my $trial = $self->release_status eq 'testing' && $self->version !~ /_/;
Condition0%0/3
$self->release_status eq 'testing' && !($self->version =~ /_/u)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->release_status eq 'testing' && !($self->version =~ /_/u)
$self->release_status eq 'testing' !($self->version =~ /_/u)
Truth table0%0/3
A && not(B)
A= $self->release_status eq 'testing'B= !($self->version =~ /_/u)
ABresult
0X0
100
111
495 0 ▶ return $self->meta->name . '-' . $self->meta->version . ($trial ? '-TRIAL' : '' );
Branch: 1 branch
BranchTrueFalseTotal
$trial ? : 0 0 0
496 }
497  
498 0 ▶sub archivename {
Subroutine archivename: not called CC=1 SCAR=6.9
Pod undocumented
499 0 my $self = shift;
500 0 return $self->fullname . '.tar.gz';
501 }
502  
503 1 1;
↑ Summary ModuleBuildTiny.pm »