| 1 | package App::Yath::Script; | ||||||||||||||||||||||||||||||||||
| 2 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||
| 5 | 13 | ▶ | use Cwd qw/realpath/; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 13 | ▶ | use Carp qw/confess/; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | 13 | ▶ | use File::Spec(); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||
| 9 | 13 | ▶ | use Importer Importer => 'import'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||
| 11 | 13 | our @EXPORT_OK = ( | |||||||||||||||||||||||||||||||||
| 12 | qw{ | ||||||||||||||||||||||||||||||||||
| 13 | script | ||||||||||||||||||||||||||||||||||
| 14 | module | ||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||
| 16 | do_exec | ||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||
| 18 | clean_path | ||||||||||||||||||||||||||||||||||
| 19 | find_in_updir | ||||||||||||||||||||||||||||||||||
| 20 | find_rc_updir | ||||||||||||||||||||||||||||||||||
| 21 | mod2file | ||||||||||||||||||||||||||||||||||
| 22 | }, | ||||||||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||
| 25 | 13 | our $VERSION = '2.000017'; | |||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||
| 27 | 13 | our ($SCRIPT, $MOD); | |||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub script { $SCRIPT } | ||||||||||||||||||||||||||||||||
|
Subroutine
script: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub module { $MOD } | ||||||||||||||||||||||||||||||||
|
Subroutine
module: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||
| 32 | 12 | ▶ | sub do_begin { | ||||||||||||||||||||||||||||||||
|
Subroutine
do_begin: called CC=9 SCAR=22.6
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 33 | # Check for an explicit version as the very first argument (V# or v#). | ||||||||||||||||||||||||||||||||||
| 34 | # Strip it from @ARGV before anything else sees it. | ||||||||||||||||||||||||||||||||||
| 35 | 12 | my $cli_version; | |||||||||||||||||||||||||||||||||
| 36 | 12 | ▶ | if (@ARGV && $ARGV[0] =~ /^[Vv](\d+)$/) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@ARGV and $ARGV[0] =~ /^[Vv](\d+)$/
MC/DC100%2/2
@ARGV and $ARGV[0] =~ /^[Vv](\d+)$/
@ARGV
$ARGV[0] =~ /^[Vv](\d+)$/
Truth table100%3/3
A and B
A= @ARGVB= $ARGV[0] =~ /^[Vv](\d+)$/
| |||||||||||||||||||||||||||||||||||
| 37 | 4 | $cli_version = int($1); | |||||||||||||||||||||||||||||||||
| 38 | 4 | shift @ARGV; | |||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||
| 41 | 12 | my $argv = [@ARGV]; | |||||||||||||||||||||||||||||||||
| 42 | 12 | my @caller = caller(); | |||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||
| 44 | 12 | my $exec = 0; | |||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||
| 46 | 12 | $SCRIPT = clean_path($caller[1]); | |||||||||||||||||||||||||||||||||
| 47 | 12 | $ENV{YATH_SCRIPT} = $SCRIPT; | |||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||
| 49 | 12 | inject_includes(); | |||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||
| 51 | 12 | my $local_vers = install_local_lib(); | |||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||
| 53 | 12 | ▶ | $exec = 1 if find_alt_script(); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||
| 55 | 12 | my ($config, $user_config, $version) = find_rc_files($cli_version); | |||||||||||||||||||||||||||||||||
| 56 | 12 | ▶ | $version //= $local_vers; | ||||||||||||||||||||||||||||||||
|
Condition33%1/3
$version //= $local_vers
MC/DC0%0/2
$version //= $local_vers
$version
$local_vers
Truth table33%1/3
A //= B
A= $versionB= $local_vers
| |||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||
| 58 | # Pre-parse the global section of the rc files for dev-libs flags | ||||||||||||||||||||||||||||||||||
| 59 | # so a user can put `-D` (etc) at the top of .yath.rc instead of on | ||||||||||||||||||||||||||||||||||
| 60 | # every CLI invocation. Only the global section is parsed -- command | ||||||||||||||||||||||||||||||||||
| 61 | # sections are reserved for the per-command parser since this layer | ||||||||||||||||||||||||||||||||||
| 62 | # has no idea which command is about to run. Run before the regular | ||||||||||||||||||||||||||||||||||
| 63 | # CLI -D pass so `T2_HARNESS_INCLUDES` carries everything across the | ||||||||||||||||||||||||||||||||||
| 64 | # re-exec triggered by either source. | ||||||||||||||||||||||||||||||||||
| 65 | 12 | ▶ | $exec = 1 if parse_rc_dev_libs($config, $user_config); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 66 | 12 | ▶ | $exec = 1 if parse_new_dev_libs(); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||
| 68 | 12 | ▶ | do_exec($argv) if $exec; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||
| 70 | 12 | ▶ | $MOD = defined($version) ? load_yath_module($version) : load_latest_yath_module(); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||
| 72 | 12 | $MOD->do_begin( | |||||||||||||||||||||||||||||||||
| 73 | script => $SCRIPT, | ||||||||||||||||||||||||||||||||||
| 74 | argv => $argv, | ||||||||||||||||||||||||||||||||||
| 75 | config => $config, | ||||||||||||||||||||||||||||||||||
| 76 | user_config => $user_config, | ||||||||||||||||||||||||||||||||||
| 77 | ); | ||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||
| 80 | 12 | ▶ | sub do_runtime { $MOD->do_runtime(@_) } | ||||||||||||||||||||||||||||||||
|
Subroutine
do_runtime: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub do_exec { | ||||||||||||||||||||||||||||||||
|
Subroutine
do_exec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 83 | 0 | my ($argv) = @_; | |||||||||||||||||||||||||||||||||
| 84 | # Hooks (coderef, arrayref, blessed object) cannot be serialized. Anything | ||||||||||||||||||||||||||||||||||
| 85 | # that installed one via PERL5OPT installs it again in the new process, so | ||||||||||||||||||||||||||||||||||
| 86 | # only the paths need to survive the exec. | ||||||||||||||||||||||||||||||||||
| 87 | 0 | $ENV{T2_HARNESS_INCLUDES} = join ';' => grep { !ref $_ } @INC; | |||||||||||||||||||||||||||||||||
| 88 | 0 | exec($^X, $SCRIPT, @$argv); | |||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||
| 91 | 12 | ▶ | sub find_alt_script { | ||||||||||||||||||||||||||||||||
|
Subroutine
find_alt_script: called CC=4 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 92 | 12 | my $script = './scripts/yath'; | |||||||||||||||||||||||||||||||||
| 93 | 12 | ▶ | return 0 unless -f $script; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | return 0 unless -x $script; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||
| 96 | 0 | $script = clean_path($script); | |||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | return 0 if $script eq clean_path($SCRIPT); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||
| 100 | 0 | $SCRIPT = $script; | |||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||
| 102 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||
| 105 | 15 | ▶ | sub parse_new_dev_libs { | ||||||||||||||||||||||||||||||||
|
Subroutine
parse_new_dev_libs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 106 | 15 | return _install_dev_libs(_collect_dev_libs(@ARGV)); | |||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||
| 109 | 20 | ▶ | sub parse_rc_dev_libs { | ||||||||||||||||||||||||||||||||
|
Subroutine
parse_rc_dev_libs: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 110 | 20 | ▶ | my @files = grep { defined && length } @_; | ||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $_ && length $_
MC/DC100%2/2
defined $_ && length $_
defined $_
length $_
Truth table100%3/3
A && B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||||||||
| 111 | 20 | ▶ | return 0 unless @files; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||
| 113 | 17 | my @args; | |||||||||||||||||||||||||||||||||
| 114 | 17 | for my $file (@files) { | |||||||||||||||||||||||||||||||||
| 115 | 18 | ▶ | next unless -f $file; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 116 | 17 | push @args => _rc_global_tokens($file); | |||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||
| 119 | 17 | return _install_dev_libs(_collect_dev_libs(@args)); | |||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||
| 122 | # Walk a list of argv-style tokens looking for -D / --dev-lib(s) flags. | ||||||||||||||||||||||||||||||||||
| 123 | # Returns the list of paths to add to @INC. | ||||||||||||||||||||||||||||||||||
| 124 | 48 | ▶ | sub _collect_dev_libs { | ||||||||||||||||||||||||||||||||
|
Subroutine
_collect_dev_libs: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||
| 125 | 48 | my @args = @_; | |||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||
| 127 | 48 | my @add; | |||||||||||||||||||||||||||||||||
| 128 | 48 | for my $arg (@args) { | |||||||||||||||||||||||||||||||||
| 129 | 55 | ▶ | last if $arg eq '::'; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 130 | 53 | ▶ | last if $arg eq '--'; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||
| 132 | 50 | ▶ | next unless $arg =~ m/^(?:-D|--dev-libs?)(?:=(.+))?$/; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 133 | 19 | my $val = $1; | |||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||
| 135 | 19 | ▶ | unless (defined $val && length $val) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $val and length $val
MC/DC50%1/2
defined $val and length $val
defined $val
length $val
Truth table66%2/3
A and B
A= defined $valB= length $val
| |||||||||||||||||||||||||||||||||||
| 136 | 4 | push @add => map { clean_path($_) } 'lib', 'blib/lib', 'blib/arch'; | |||||||||||||||||||||||||||||||||
| 137 | 4 | next; | |||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||
| 140 | 15 | for my $path (split /,/, $val) { | |||||||||||||||||||||||||||||||||
| 141 | 13 | ▶ | if ($path =~ m/\*/) { push @add => glob($path) } | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 142 | 18 | else { push @add => $path } | |||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||
| 146 | 48 | return @add; | |||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||
| 149 | # Dedup against @INC and prepend. Returns 1 if anything was added. | ||||||||||||||||||||||||||||||||||
| 150 | 36 | ▶ | sub _install_dev_libs { | ||||||||||||||||||||||||||||||||
|
Subroutine
_install_dev_libs: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||
| 151 | 36 | my @add = @_; | |||||||||||||||||||||||||||||||||
| 152 | 36 | ▶ | return 0 unless @add; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||
| 154 | 6 | my %seen = map { ($_ => 1, clean_path($_) => 1) } @INC; | |||||||||||||||||||||||||||||||||
| 155 | 6 | ▶ | @add = grep { !($seen{$_} || $seen{clean_path($_)}) } @add; | ||||||||||||||||||||||||||||||||
|
Condition66%2/3
$seen{$_} || $seen{clean_path($_)}
MC/DC50%1/2
$seen{$_} || $seen{clean_path($_)}
$seen{$_}
$seen{clean_path($_)}
Truth table66%2/3
A || B
A= $seen{$_}B= $seen{clean_path($_)}
| |||||||||||||||||||||||||||||||||||
| 156 | 6 | ▶ | return 0 unless @add; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||
| 158 | 5 | unshift @INC => @add; | |||||||||||||||||||||||||||||||||
| 159 | 5 | return 1; | |||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||
| 162 | # Tokenize the global section of an rc file into argv-style tokens. | ||||||||||||||||||||||||||||||||||
| 163 | # Stops at the first [section] marker. `--foo` and `--foo=bar` lines | ||||||||||||||||||||||||||||||||||
| 164 | # yield one token; `--foo bar` lines yield two, matching the format | ||||||||||||||||||||||||||||||||||
| 165 | # App::Yath2::ConfigFile uses for command sections. | ||||||||||||||||||||||||||||||||||
| 166 | 22 | ▶ | sub _rc_global_tokens { | ||||||||||||||||||||||||||||||||
|
Subroutine
_rc_global_tokens: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||
| 167 | 22 | my ($file) = @_; | |||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||
| 169 | 22 | my @args; | |||||||||||||||||||||||||||||||||
| 170 | 22 | ▶ | open(my $fh, '<', $file) or return; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 171 | 22 | ▶ | while (my $line = <$fh>) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 172 | 21 | chomp $line; | |||||||||||||||||||||||||||||||||
| 173 | 21 | $line =~ s/\s*[#;].*//; | |||||||||||||||||||||||||||||||||
| 174 | 21 | $line =~ s/^\s+//; | |||||||||||||||||||||||||||||||||
| 175 | 21 | $line =~ s/\s+$//; | |||||||||||||||||||||||||||||||||
| 176 | 21 | ▶ | next unless length $line; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 177 | 17 | ▶ | last if $line =~ /^\[/; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||
| 179 | 13 | ▶ | if ($line =~ /^(\S+)\s+(.+)$/) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 180 | 1 | push @args => ($1, $2); | |||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||
| 182 | else { | ||||||||||||||||||||||||||||||||||
| 183 | 12 | push @args => $line; | |||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||
| 186 | 22 | close($fh); | |||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||
| 188 | 22 | return @args; | |||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||
| 191 | # Locate the project- and user-level rc files plus the version number | ||||||||||||||||||||||||||||||||||
| 192 | # they imply. Returns ($config, $user_config, $version), each of which | ||||||||||||||||||||||||||||||||||
| 193 | # may be undef. When $cli_version is defined the caller's explicit | ||||||||||||||||||||||||||||||||||
| 194 | # version always wins; only versioned rc files matching that version | ||||||||||||||||||||||||||||||||||
| 195 | # are looked up. | ||||||||||||||||||||||||||||||||||
| 196 | 18 | ▶ | sub find_rc_files { | ||||||||||||||||||||||||||||||||
|
Subroutine
find_rc_files: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 197 | 18 | my ($cli_version) = @_; | |||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||
| 199 | 18 | ▶ | if (defined $cli_version) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 200 | # Explicit version on CLI: prefer matching versioned rc files, | ||||||||||||||||||||||||||||||||||
| 201 | # but fall back to plain .yath.rc / .yath.user.rc when no | ||||||||||||||||||||||||||||||||||
| 202 | # versioned match exists. Accept both .yath.v#.rc and | ||||||||||||||||||||||||||||||||||
| 203 | # .yath.V#.rc. | ||||||||||||||||||||||||||||||||||
| 204 | 7 | ▶ | my $config = find_in_updir(".yath.v${cli_version}.rc") | ||||||||||||||||||||||||||||||||
|
Condition100%6/6
(find_in_updir(".yath.v$cli_version.rc") // find_in_updir(".yath.V$cli_version.rc")) // find_in_updir(".yath.rc")
find_in_updir(".yath.v$cli_version.rc") // find_in_updir(".yath.V$cli_version.rc")
MC/DC100%3/3
(find_in_updir(".yath.v$cli_version.rc") // find_in_updir(".yath.V$cli_version.rc")) // find_in_updir(".yath.rc")
find_in_updir(".yath.v$cli_version.rc")
find_in_updir(".yath.V$cli_version.rc")
find_in_updir(".yath.rc")
Truth table100%4/4
A // B // C
A= find_in_updir(".yath.v$cli_version.rc")B= find_in_updir(".yath.V$cli_version.rc")C= find_in_updir(".yath.rc")
| |||||||||||||||||||||||||||||||||||
| 205 | // find_in_updir(".yath.V${cli_version}.rc") | ||||||||||||||||||||||||||||||||||
| 206 | // find_in_updir(".yath.rc"); | ||||||||||||||||||||||||||||||||||
| 207 | 7 | ▶ | my $user_config = find_in_updir(".yath.user.v${cli_version}.rc") | ||||||||||||||||||||||||||||||||
|
Condition83%5/6
(find_in_updir(".yath.user.v$cli_version.rc") // find_in_updir(".yath.user.V$cli_version.rc")) // find_in_updir(".yath.user.rc")
find_in_updir(".yath.user.v$cli_version.rc") // find_in_updir(".yath.user.V$cli_version.rc")
MC/DC66%2/3
(find_in_updir(".yath.user.v$cli_version.rc") // find_in_updir(".yath.user.V$cli_version.rc")) // find_in_updir(".yath.user.rc")
find_in_updir(".yath.user.v$cli_version.rc")
find_in_updir(".yath.user.V$cli_version.rc")
find_in_updir(".yath.user.rc")
Truth table75%3/4
A // B // C
A= find_in_updir(".yath.user.v$cli_version.rc")B= find_in_updir(".yath.user.V$cli_version.rc")C= find_in_updir(".yath.user.rc")
| |||||||||||||||||||||||||||||||||||
| 208 | // find_in_updir(".yath.user.V${cli_version}.rc") | ||||||||||||||||||||||||||||||||||
| 209 | // find_in_updir(".yath.user.rc"); | ||||||||||||||||||||||||||||||||||
| 210 | 7 | return ($config, $user_config, $cli_version); | |||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||
| 213 | 11 | my ($config, $config_version) = find_rc_updir('.yath'); | |||||||||||||||||||||||||||||||||
| 214 | 11 | my ($user_config, $user_version) = find_rc_updir('.yath.user'); | |||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||
| 216 | # .yath.user(.v#).rc version takes precedence over .yath(.v#).rc. | ||||||||||||||||||||||||||||||||||
| 217 | # Either may be undef (plain unversioned rc); when both are undef | ||||||||||||||||||||||||||||||||||
| 218 | # the caller falls back to install_local_lib's version, then to | ||||||||||||||||||||||||||||||||||
| 219 | # load_yath_module's @INC scan. | ||||||||||||||||||||||||||||||||||
| 220 | 11 | ▶ | my $version = $user_version // $config_version; | ||||||||||||||||||||||||||||||||
|
Condition100%3/3
$user_version // $config_version
MC/DC100%2/2
$user_version // $config_version
$user_version
$config_version
Truth table100%3/3
A // B
A= $user_versionB= $config_version
| |||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||
| 222 | 11 | return ($config, $user_config, $version); | |||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||
| 225 | # Load and return the App::Yath::Script::V{X} module to delegate to. | ||||||||||||||||||||||||||||||||||
| 226 | # Dies if the requested module fails to load. V0 is reserved for | ||||||||||||||||||||||||||||||||||
| 227 | # script validation and emits a warning when explicitly requested. | ||||||||||||||||||||||||||||||||||
| 228 | 14 | ▶ | sub load_yath_module { | ||||||||||||||||||||||||||||||||
|
Subroutine
load_yath_module: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 229 | 14 | my ($version) = @_; | |||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||
| 231 | 14 | ▶ | warn "Warning: Version '0' is for validating the yath script only, it should not be used for any real testing.\n" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 232 | if $version == 0; | ||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||
| 234 | 14 | my $mod = "App::Yath::Script::V${version}"; | |||||||||||||||||||||||||||||||||
| 235 | 14 | my $file = mod2file($mod); | |||||||||||||||||||||||||||||||||
| 236 | 14 | ▶ | eval { require $file; 1 } or die "Could not load $mod: $@"; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 237 | 13 | return $mod; | |||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||
| 240 | # Scan @INC for installed App::Yath::Script::V#.pm modules and return | ||||||||||||||||||||||||||||||||||
| 241 | # the version numbers sorted highest-first. V0 is excluded since it is | ||||||||||||||||||||||||||||||||||
| 242 | # reserved for script validation and must never be auto-selected. | ||||||||||||||||||||||||||||||||||
| 243 | 4 | ▶ | sub find_installed_versions { | ||||||||||||||||||||||||||||||||
|
Subroutine
find_installed_versions: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 244 | 4 | my %found; | |||||||||||||||||||||||||||||||||
| 245 | 4 | for my $inc (@INC) { | |||||||||||||||||||||||||||||||||
| 246 | 4 | ▶ | next if ref $inc; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 247 | 4 | my $dir = File::Spec->catdir($inc, 'App', 'Yath', 'Script'); | |||||||||||||||||||||||||||||||||
| 248 | 4 | ▶ | next unless -d $dir; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 249 | 3 | ▶ | opendir(my $dh, $dir) or next; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 250 | 3 | for my $entry (readdir $dh) { | |||||||||||||||||||||||||||||||||
| 251 | 14 | ▶ | $found{$1} = 1 if $entry =~ /^V(\d+)\.pm$/; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||
| 253 | 3 | closedir $dh; | |||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||
| 255 | 4 | delete $found{0}; | |||||||||||||||||||||||||||||||||
| 256 | 4 | return sort { $b <=> $a } keys %found; | |||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||
| 259 | # Final fallback when no version was captured from CLI, rc files, or a | ||||||||||||||||||||||||||||||||||
| 260 | # local checkout. Tries each installed App::Yath::Script::V# module | ||||||||||||||||||||||||||||||||||
| 261 | # from highest to lowest until one loads. Dies with the collected load | ||||||||||||||||||||||||||||||||||
| 262 | # errors if none succeed (or if none are installed). | ||||||||||||||||||||||||||||||||||
| 263 | 3 | ▶ | sub load_latest_yath_module { | ||||||||||||||||||||||||||||||||
|
Subroutine
load_latest_yath_module: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 264 | 3 | my @vers = find_installed_versions(); | |||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||
| 266 | 3 | ▶ | die "No App::Yath (App::Yath::Script::V#) modules appear to be installed.\n" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 267 | unless @vers; | ||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||
| 269 | 2 | my @err; | |||||||||||||||||||||||||||||||||
| 270 | 2 | for my $v (@vers) { | |||||||||||||||||||||||||||||||||
| 271 | 3 | my $mod = "App::Yath::Script::V${v}"; | |||||||||||||||||||||||||||||||||
| 272 | 3 | my $file = mod2file($mod); | |||||||||||||||||||||||||||||||||
| 273 | 3 | ▶ | return $mod if eval { require $file; 1 }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 274 | 1 | push @err => $@; | |||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||
| 277 | 0 | die join "\n" => ( | |||||||||||||||||||||||||||||||||
| 278 | "No Test2::Harness (App::Yath) versions could be loaded:", | ||||||||||||||||||||||||||||||||||
| 279 | @err, | ||||||||||||||||||||||||||||||||||
| 280 | ); | ||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||
| 283 | 15 | ▶ | sub inject_includes { | ||||||||||||||||||||||||||||||||
|
Subroutine
inject_includes: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 284 | 15 | ▶ | return unless $ENV{T2_HARNESS_INCLUDES}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 285 | # Keep any hooks this process already has. PERL5OPT runs before us, so a | ||||||||||||||||||||||||||||||||||
| 286 | # tool like Carmel has already reinstalled the hook that makes its modules | ||||||||||||||||||||||||||||||||||
| 287 | # findable, and replacing @INC outright would throw it away. | ||||||||||||||||||||||||||||||||||
| 288 | 2 | @INC = (grep({ ref $_ } @INC), split(/;/, $ENV{T2_HARNESS_INCLUDES})); | |||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||
| 291 | # Scan ./lib/App/Yath/Script for V#.pm modules and return the highest | ||||||||||||||||||||||||||||||||||
| 292 | # version found, or undef when no such modules are present. Used by | ||||||||||||||||||||||||||||||||||
| 293 | # install_local_lib() to detect a working-copy checkout that ships its | ||||||||||||||||||||||||||||||||||
| 294 | # own versioned script module. | ||||||||||||||||||||||||||||||||||
| 295 | 21 | ▶ | sub find_local_version { | ||||||||||||||||||||||||||||||||
|
Subroutine
find_local_version: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 296 | 21 | my $local_path = File::Spec->catdir(File::Spec->curdir, 'lib', 'App', 'Yath', 'Script'); | |||||||||||||||||||||||||||||||||
| 297 | 21 | ▶ | return undef unless -d $local_path; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 298 | 6 | ▶ | opendir(my $dh, $local_path) or return undef; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||
| 300 | 6 | my $vers; | |||||||||||||||||||||||||||||||||
| 301 | 6 | for my $file (readdir($dh)) { | |||||||||||||||||||||||||||||||||
| 302 | 22 | ▶ | next unless $file =~ m/^V(\d+)\.pm$/; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 303 | 9 | my $n = int($1); | |||||||||||||||||||||||||||||||||
| 304 | 9 | ▶ | $vers = $n if !defined($vers) || $n > $vers; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $vers or $n > $vers
MC/DC100%2/2
not defined $vers or $n > $vers
not defined $vers
$n > $vers
Truth table100%3/3
not(A) or B
A= not defined $versB= $n > $vers
| |||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||
| 306 | 6 | closedir $dh; | |||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||
| 308 | 6 | return $vers; | |||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||
| 311 | # If the cwd contains ./lib/App/Yath/Script/V#.pm modules, ensure ./lib | ||||||||||||||||||||||||||||||||||
| 312 | # is at the front of @INC so they take precedence over any installed | ||||||||||||||||||||||||||||||||||
| 313 | # copy. Returns the highest local version found, or undef if no local | ||||||||||||||||||||||||||||||||||
| 314 | # modules exist. Idempotent: a re-exec that already has ./lib in @INC | ||||||||||||||||||||||||||||||||||
| 315 | # (via T2_HARNESS_INCLUDES) does not re-print or re-unshift. | ||||||||||||||||||||||||||||||||||
| 316 | 15 | ▶ | sub install_local_lib { | ||||||||||||||||||||||||||||||||
|
Subroutine
install_local_lib: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 317 | 15 | my $local_vers = find_local_version(); | |||||||||||||||||||||||||||||||||
| 318 | 15 | ▶ | return undef unless defined $local_vers; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||
| 320 | 2 | my $lib_path = clean_path(File::Spec->catdir(File::Spec->curdir, 'lib')); | |||||||||||||||||||||||||||||||||
| 321 | 2 | ▶ | return $local_vers if grep { clean_path($_) eq $lib_path } @INC; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||
| 323 | 1 | print "Detected App::Yath::Script::V# modules in local ./lib, adding '$lib_path' to the front of \@INC.\n"; | |||||||||||||||||||||||||||||||||
| 324 | 1 | unshift @INC => $lib_path; | |||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||
| 326 | 1 | return $local_vers; | |||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||
| 329 | 70 | ▶ | sub clean_path { | ||||||||||||||||||||||||||||||||
|
Subroutine
clean_path: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 330 | 70 | my ( $path, $absolute ) = @_; | |||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||
| 332 | 70 | ▶ | confess "No path was provided to clean_path()" unless $path; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||
| 334 | 68 | ▶ | $absolute //= 1; | ||||||||||||||||||||||||||||||||
|
Condition100%2/2
$absolute //= 1
MC/DC100%1/1
$absolute //= 1
$absolute
Truth table100%2/2
A
A= $absolute
| |||||||||||||||||||||||||||||||||||
| 335 | 68 | ▶ | $path = realpath($path) // $path if $absolute; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
realpath($path) // $path
MC/DC0%0/2
realpath($path) // $path
realpath($path)
$path
Truth table66%2/3
A // B
A= realpath($path)B= $path
| |||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||
| 337 | 68 | return File::Spec->rel2abs($path); | |||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||
| 340 | 37 | ▶ | sub find_rc_updir { | ||||||||||||||||||||||||||||||||
|
Subroutine
find_rc_updir: called CC=14 SCAR=26.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 341 | 37 | my ($prefix) = @_; | |||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||
| 343 | 37 | my $versioned_pattern = qr/^\Q$prefix\E\.[Vv](\d+)\.rc$/; | |||||||||||||||||||||||||||||||||
| 344 | 37 | my $plain_name = "$prefix.rc"; | |||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||
| 346 | 37 | my $abs = eval { realpath(File::Spec->rel2abs('.')) }; | |||||||||||||||||||||||||||||||||
| 347 | 37 | my %seen; | |||||||||||||||||||||||||||||||||
| 348 | 37 | ▶ | while ($abs && !$seen{$abs}++) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$abs and not $seen{$abs}++
MC/DC50%1/2
$abs and not $seen{$abs}++
$abs
not $seen{$abs}++
Truth table66%2/3
A and not(B)
A= $absB= not $seen{$abs}++
| |||||||||||||||||||||||||||||||||||
| 349 | # Priority 1: plain name that is a symlink to a versioned file. | ||||||||||||||||||||||||||||||||||
| 350 | 60 | my $plain_path = File::Spec->catfile($abs, $plain_name); | |||||||||||||||||||||||||||||||||
| 351 | 60 | ▶ | if (-l $plain_path && -f $plain_path) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-l $plain_path and -f $plain_path
MC/DC50%1/2
-l $plain_path and -f $plain_path
-l $plain_path
-f $plain_path
Truth table66%2/3
A and B
A= -l $plain_pathB= -f $plain_path
| |||||||||||||||||||||||||||||||||||
| 352 | 5 | ▶ | my $target = readlink($plain_path) // ''; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
readlink $plain_path // ""
MC/DC0%0/1
readlink $plain_path // ""
readlink $plain_path
Truth table50%1/2
A
A= readlink $plain_path
| |||||||||||||||||||||||||||||||||||
| 353 | 5 | ▶ | if ((File::Spec->splitpath($target))[2] =~ $versioned_pattern) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 354 | 5 | return ($plain_path, int($1)); | |||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||
| 358 | # Priority 2: explicitly versioned file -- highest version wins. | ||||||||||||||||||||||||||||||||||
| 359 | 55 | ▶ | if (opendir(my $dh, $abs)) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 360 | 55 | my ($best_ver, $best_entry); | |||||||||||||||||||||||||||||||||
| 361 | 55 | for my $entry (readdir $dh) { | |||||||||||||||||||||||||||||||||
| 362 | 498 | ▶ | next unless $entry =~ $versioned_pattern; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 363 | 20 | my $v = int($1); | |||||||||||||||||||||||||||||||||
| 364 | 20 | ▶ | if (!defined($best_ver) || $v > $best_ver) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $best_ver or $v > $best_ver
MC/DC100%2/2
not defined $best_ver or $v > $best_ver
not defined $best_ver
$v > $best_ver
Truth table100%3/3
not(A) or B
A= not defined $best_verB= $v > $best_ver
| |||||||||||||||||||||||||||||||||||
| 365 | 19 | $best_ver = $v; | |||||||||||||||||||||||||||||||||
| 366 | 19 | $best_entry = $entry; | |||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||
| 369 | 55 | closedir $dh; | |||||||||||||||||||||||||||||||||
| 370 | 55 | ▶ | if (defined $best_ver) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 371 | 17 | return (File::Spec->catfile($abs, $best_entry), $best_ver); | |||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||
| 375 | # Priority 3: plain unversioned file -- no version captured, the | ||||||||||||||||||||||||||||||||||
| 376 | # caller (find_rc_files / install_local_lib / load_yath_module) | ||||||||||||||||||||||||||||||||||
| 377 | # decides what version to use. | ||||||||||||||||||||||||||||||||||
| 378 | 38 | ▶ | if (-f $plain_path) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 379 | 4 | return ($plain_path, undef); | |||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||
| 382 | 34 | $abs = eval { realpath(File::Spec->catdir($abs, '..')) }; | |||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||
| 385 | 11 | return; | |||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||
| 388 | 33 | ▶ | sub find_in_updir { | ||||||||||||||||||||||||||||||||
|
Subroutine
find_in_updir: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 389 | 33 | my $path = shift; | |||||||||||||||||||||||||||||||||
| 390 | 33 | ▶ | return clean_path($path) if -e $path; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||
| 392 | 24 | my %seen; | |||||||||||||||||||||||||||||||||
| 393 | 24 | while(1) { | |||||||||||||||||||||||||||||||||
| 394 | 75 | $path = File::Spec->catdir('..', $path); | |||||||||||||||||||||||||||||||||
| 395 | 75 | my $check = eval { realpath(File::Spec->rel2abs($path)) }; | |||||||||||||||||||||||||||||||||
| 396 | 75 | ▶ | last unless $check; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 397 | 75 | ▶ | last if $seen{$check}++; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 398 | 51 | ▶ | return $check if -e $check; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||
| 401 | 24 | return; | |||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||
| 404 | 22 | ▶ | sub mod2file { | ||||||||||||||||||||||||||||||||
|
Subroutine
mod2file: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 405 | 22 | my ($mod) = @_; | |||||||||||||||||||||||||||||||||
| 406 | 22 | ▶ | confess "No module name provided" unless $mod; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 407 | 20 | my $file = $mod; | |||||||||||||||||||||||||||||||||
| 408 | 20 | $file =~ s{::}{/}g; | |||||||||||||||||||||||||||||||||
| 409 | 20 | $file .= ".pm"; | |||||||||||||||||||||||||||||||||
| 410 | 20 | return $file; | |||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||
| 413 | 13 | 1; | |||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||
| 415 | __END__ | ||||||||||||||||||||||||||||||||||