« CPAN/Maker/Bootstrapper/Role/ShowDefaults.pm
↑ Summary
CPAN/Maker/Bootstrapper/Role/ScaffoldImporter.pm »
| 1 | package CPAN::Maker::Bootstrapper::Role::DistFile; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use CLI::Simple::Constants qw(:booleans); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use CLI::Simple::Utils qw(slurp); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use English qw(-no_match_vars); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use File::ShareDir qw(dist_dir); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Role::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | ######################################################################## | ||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub cmd_dist_file { | ||||||||||||||||||||||||||
|
Subroutine
cmd_dist_file: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | ######################################################################## | ||||||||||||||||||||||||||||
| 17 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | my ( $distribution, $file ) = $self->get_args; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | die "usage: dist-file distribution file\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$distribution and $file
MC/DC0%0/2
$distribution and $file
$distribution
$file
Truth table0%0/3
A and B
A= $distributionB= $file
| |||||||||||||||||||||||||||||
| 22 | if !$distribution || !$file; | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | my $content = eval { | |||||||||||||||||||||||||||
| 25 | 0 | my $dist_dir = dist_dir($distribution); | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | my ($path) = grep { -e "$dist_dir/$_" } ( $file, "share/$file" ); | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | die "$file not found in $distribution\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | if !$path; | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | return slurp $path; | |||||||||||||||||||||||||||
| 33 | }; | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | die "ERROR: could not fetch $file from $distribution\n$EVAL_ERROR" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $content or $CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR
MC/DC0%0/2
not $content or $CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR
not $content
$CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR
Truth table0%0/3
not(A) or B
A= not $contentB= $CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR
| |||||||||||||||||||||||||||||
| 36 | if !$content || $EVAL_ERROR; | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | print {*STDOUT} $content; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | return $SUCCESS; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 2 | 1; | |||||||||||||||||||||||||||