| 1 | package alienfile; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 57 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 57 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 57 | ▶ | use 5.008004; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 57 | ▶ | use Alien::Build; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 57 | ▶ | use Exporter (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 57 | ▶ | use Path::Tiny (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 57 | ▶ | use Carp (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub _path { Path::Tiny::path(@_) } | ||||||||||||||||||||||||||
|
Subroutine
_path: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | # ABSTRACT: Specification for defining an external dependency for CPAN | ||||||||||||||||||||||||||||
| 14 | 57 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 57 | our @EXPORT = qw( requires on plugin probe configure share sys download fetch decode prefer extract patch patch_ffi build build_ffi gather gather_ffi meta_prop ffi log test start_url before after digest ); | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | sub requires | ||||||||||||||||||||||||||||
| 21 | 32 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
requires: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 22 | 32 | my($module, $version) = @_; | |||||||||||||||||||||||||||
| 23 | 32 | ▶ | $version ||= 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
$version ||= 0
MC/DC100%1/1
$version ||= 0
$version
Truth table100%2/2
A
A= $version
| |||||||||||||||||||||||||||||
| 24 | 32 | my $caller = caller; | |||||||||||||||||||||||||||
| 25 | 32 | my $meta = $caller->meta; | |||||||||||||||||||||||||||
| 26 | 32 | $meta->add_requires($meta->{phase}, $module, $version); | |||||||||||||||||||||||||||
| 27 | 32 | (); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | sub plugin | ||||||||||||||||||||||||||||
| 32 | 225 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
plugin: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 225 | my($name, @args) = @_; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 225 | my $caller = caller; | |||||||||||||||||||||||||||
| 36 | 225 | $caller->meta->apply_plugin($name, @args); | |||||||||||||||||||||||||||
| 37 | 223 | return; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | sub probe | ||||||||||||||||||||||||||||
| 42 | 122 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
probe: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 122 | my($instr) = @_; | |||||||||||||||||||||||||||
| 44 | 122 | my $caller = caller; | |||||||||||||||||||||||||||
| 45 | 122 | ▶ | if(my $phase = $caller->meta->{phase}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||
| 47 | 122 | ▶ | Carp::croak "probe must not be in a $phase block" if $phase ne 'any'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | 121 | $caller->meta->register_hook(probe => $instr); | |||||||||||||||||||||||||||
| 50 | 121 | return; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | sub _phase | ||||||||||||||||||||||||||||
| 55 | 165 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_phase: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 56 | 165 | my($code, $phase) = @_; | |||||||||||||||||||||||||||
| 57 | 165 | my $caller = caller(1); | |||||||||||||||||||||||||||
| 58 | 165 | my $meta = $caller->meta; | |||||||||||||||||||||||||||
| 59 | 165 | local $meta->{phase} = $phase; | |||||||||||||||||||||||||||
| 60 | 165 | $code->(); | |||||||||||||||||||||||||||
| 61 | 155 | return; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | sub configure (&) | ||||||||||||||||||||||||||||
| 65 | 10 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
configure: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 66 | 10 | _phase($_[0], 'configure'); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | sub sys (&) | ||||||||||||||||||||||||||||
| 71 | 22 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
sys: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | 22 | _phase($_[0], 'system'); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | sub share (&) | ||||||||||||||||||||||||||||
| 78 | 133 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
share: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 79 | 133 | _phase($_[0], 'share'); | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | sub _in_phase | ||||||||||||||||||||||||||||
| 84 | 170 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_in_phase: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 85 | 170 | my($phase) = @_; | |||||||||||||||||||||||||||
| 86 | 170 | my $caller = caller(1); | |||||||||||||||||||||||||||
| 87 | 170 | my(undef, undef, undef, $sub) = caller(1); | |||||||||||||||||||||||||||
| 88 | 170 | my $meta = $caller->meta; | |||||||||||||||||||||||||||
| 89 | 170 | $sub =~ s/^.*:://; | |||||||||||||||||||||||||||
| 90 | Carp::croak "$sub must be in a $phase block" | ||||||||||||||||||||||||||||
| 91 | 170 | ▶ | unless $meta->{phase} eq $phase; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | sub start_url | ||||||||||||||||||||||||||||
| 95 | 37 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
start_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 37 | my($url) = @_; | |||||||||||||||||||||||||||
| 97 | 37 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 98 | 37 | my $caller = caller; | |||||||||||||||||||||||||||
| 99 | 37 | my $meta = $caller->meta; | |||||||||||||||||||||||||||
| 100 | 37 | $meta->prop->{start_url} = $url; | |||||||||||||||||||||||||||
| 101 | 37 | $meta->add_requires('configure' => 'Alien::Build' => '1.19'); | |||||||||||||||||||||||||||
| 102 | 37 | return; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | sub digest | ||||||||||||||||||||||||||||
| 107 | 11 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
digest: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 108 | 11 | my($algo, $digest) = @_; | |||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 11 | my $caller = caller; | |||||||||||||||||||||||||||
| 111 | 11 | $caller->meta->apply_plugin('Digest', [$algo, $digest]); | |||||||||||||||||||||||||||
| 112 | 11 | return; | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | sub download | ||||||||||||||||||||||||||||
| 117 | 19 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
download: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 118 | 19 | my($instr) = @_; | |||||||||||||||||||||||||||
| 119 | 19 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 120 | 18 | my $caller = caller; | |||||||||||||||||||||||||||
| 121 | 18 | $caller->meta->register_hook(download => $instr); | |||||||||||||||||||||||||||
| 122 | 18 | return; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | sub fetch | ||||||||||||||||||||||||||||
| 127 | 21 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 128 | 21 | my($instr) = @_; | |||||||||||||||||||||||||||
| 129 | 21 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 130 | 21 | my $caller = caller; | |||||||||||||||||||||||||||
| 131 | 21 | $caller->meta->register_hook(fetch => $instr); | |||||||||||||||||||||||||||
| 132 | 21 | return; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | sub decode | ||||||||||||||||||||||||||||
| 137 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
decode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 138 | 2 | my($instr) = @_; | |||||||||||||||||||||||||||
| 139 | 2 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 140 | 2 | my $caller = caller; | |||||||||||||||||||||||||||
| 141 | 2 | $caller->meta->register_hook(decode => $instr); | |||||||||||||||||||||||||||
| 142 | 2 | return; | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | sub prefer | ||||||||||||||||||||||||||||
| 147 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
prefer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 148 | 2 | my($instr) = @_; | |||||||||||||||||||||||||||
| 149 | 2 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 150 | 2 | my $caller = caller; | |||||||||||||||||||||||||||
| 151 | 2 | $caller->meta->register_hook(prefer => $instr); | |||||||||||||||||||||||||||
| 152 | 2 | return; | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | sub extract | ||||||||||||||||||||||||||||
| 157 | 13 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
extract: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 158 | 13 | my($instr) = @_; | |||||||||||||||||||||||||||
| 159 | 13 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 160 | 13 | my $caller = caller; | |||||||||||||||||||||||||||
| 161 | 13 | $caller->meta->register_hook(extract => $instr); | |||||||||||||||||||||||||||
| 162 | 13 | return; | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | sub patch | ||||||||||||||||||||||||||||
| 167 | 6 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
patch: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 168 | 6 | my($instr) = @_; | |||||||||||||||||||||||||||
| 169 | 6 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 170 | 6 | my $caller = caller; | |||||||||||||||||||||||||||
| 171 | 6 | my $suffix = $caller->meta->{build_suffix}; | |||||||||||||||||||||||||||
| 172 | 6 | $caller->meta->register_hook("patch$suffix" => $instr); | |||||||||||||||||||||||||||
| 173 | 6 | return; | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | sub patch_ffi | ||||||||||||||||||||||||||||
| 178 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
patch_ffi: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 179 | 2 | my($instr) = @_; | |||||||||||||||||||||||||||
| 180 | 2 | Carp::carp("patch_ffi is deprecated, use ffi { patch ... } } instead"); | |||||||||||||||||||||||||||
| 181 | 2 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 182 | 2 | my $caller = caller; | |||||||||||||||||||||||||||
| 183 | 2 | $caller->meta->register_hook(patch_ffi => $instr); | |||||||||||||||||||||||||||
| 184 | 2 | return; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | sub build | ||||||||||||||||||||||||||||
| 189 | 50 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
build: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 190 | 50 | my($instr) = @_; | |||||||||||||||||||||||||||
| 191 | 50 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 192 | 50 | my $caller = caller; | |||||||||||||||||||||||||||
| 193 | 50 | my $suffix = $caller->meta->{build_suffix}; | |||||||||||||||||||||||||||
| 194 | 50 | $caller->meta->register_hook("build$suffix" => $instr); | |||||||||||||||||||||||||||
| 195 | 50 | return; | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | sub build_ffi | ||||||||||||||||||||||||||||
| 200 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
build_ffi: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 201 | 2 | my($instr) = @_; | |||||||||||||||||||||||||||
| 202 | 2 | Carp::carp("build_ffi is deprecated, use ffi { build ... } } instead"); | |||||||||||||||||||||||||||
| 203 | 2 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 204 | 2 | my $caller = caller; | |||||||||||||||||||||||||||
| 205 | 2 | $caller->meta->register_hook(build_ffi => $instr); | |||||||||||||||||||||||||||
| 206 | 2 | return; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | sub gather | ||||||||||||||||||||||||||||
| 211 | 24 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
gather: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||
| 212 | 24 | my($instr) = @_; | |||||||||||||||||||||||||||
| 213 | 24 | my $caller = caller; | |||||||||||||||||||||||||||
| 214 | 24 | my $meta = $caller->meta; | |||||||||||||||||||||||||||
| 215 | 24 | my $phase = $meta->{phase}; | |||||||||||||||||||||||||||
| 216 | 24 | ▶ | Carp::croak "gather is not allowed in configure block" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | if $phase eq 'configure'; | ||||||||||||||||||||||||||||
| 218 | 23 | my $suffix = $caller->meta->{build_suffix}; | |||||||||||||||||||||||||||
| 219 | 23 | ▶ | if($suffix eq '_ffi') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | { | ||||||||||||||||||||||||||||
| 221 | 4 | $meta->register_hook(gather_ffi => $instr) | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | else | ||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||
| 225 | 19 | ▶ | $meta->register_hook(gather_system => $instr) if $phase =~ /^(any|system)$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | 19 | ▶ | $meta->register_hook(gather_share => $instr) if $phase =~ /^(any|share)$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | 23 | return; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | sub gather_ffi | ||||||||||||||||||||||||||||
| 233 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
gather_ffi: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 234 | 2 | my($instr) = @_; | |||||||||||||||||||||||||||
| 235 | 2 | Carp::carp("gather_ffi is deprecated, use ffi { gather ... } } instead"); | |||||||||||||||||||||||||||
| 236 | 2 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 237 | 2 | my $caller = caller; | |||||||||||||||||||||||||||
| 238 | 2 | $caller->meta->register_hook(gather_ffi => $instr); | |||||||||||||||||||||||||||
| 239 | 2 | return; | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | sub ffi (&) | ||||||||||||||||||||||||||||
| 244 | 14 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ffi: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 245 | 14 | my($code) = @_; | |||||||||||||||||||||||||||
| 246 | 14 | _in_phase 'share'; | |||||||||||||||||||||||||||
| 247 | 14 | my $caller = caller; | |||||||||||||||||||||||||||
| 248 | 14 | local $caller->meta->{build_suffix} = '_ffi'; | |||||||||||||||||||||||||||
| 249 | 14 | $code->(); | |||||||||||||||||||||||||||
| 250 | 14 | return; | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | sub meta_prop | ||||||||||||||||||||||||||||
| 255 | 10 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
meta_prop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 256 | 10 | my $caller = caller; | |||||||||||||||||||||||||||
| 257 | 10 | my $meta = $caller->meta; | |||||||||||||||||||||||||||
| 258 | 10 | $meta->prop; | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | sub log | ||||||||||||||||||||||||||||
| 263 | 10 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
log: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 264 | 10 | unshift @_, 'Alien::Build'; | |||||||||||||||||||||||||||
| 265 | 10 | goto &Alien::Build::log; | |||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | sub test | ||||||||||||||||||||||||||||
| 270 | 23 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
test: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||
| 271 | 23 | my($instr) = @_; | |||||||||||||||||||||||||||
| 272 | 23 | my $caller = caller; | |||||||||||||||||||||||||||
| 273 | 23 | my $meta = $caller->meta; | |||||||||||||||||||||||||||
| 274 | 23 | my $phase = $meta->{phase}; | |||||||||||||||||||||||||||
| 275 | 23 | ▶ | Carp::croak "test is not allowed in $phase block" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$phase eq "any" or $phase eq "configure"
MC/DC100%2/2
$phase eq "any" or $phase eq "configure"
$phase eq "any"
$phase eq "configure"
Truth table100%3/3
A or B
A= $phase eq "any"B= $phase eq "configure"
| |||||||||||||||||||||||||||||
| 276 | if $phase eq 'any' || $phase eq 'configure'; | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 21 | $meta->add_requires('configure' => 'Alien::Build' => '1.14'); | |||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | 21 | ▶ | if($phase eq 'share') | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 281 | { | ||||||||||||||||||||||||||||
| 282 | 14 | ▶ | my $suffix = $caller->meta->{build_suffix} || '_share'; | ||||||||||||||||||||||||||
|
Condition100%2/2
$caller->meta->{'build_suffix'} || '_share'
MC/DC100%1/1
$caller->meta->{'build_suffix'} || '_share'
$caller->meta->{'build_suffix'}
Truth table100%2/2
A
A= $caller->meta->{'build_suffix'}
| |||||||||||||||||||||||||||||
| 283 | 14 | $meta->register_hook( | |||||||||||||||||||||||||||
| 284 | "test$suffix" => $instr, | ||||||||||||||||||||||||||||
| 285 | ); | ||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | elsif($phase eq 'system') | ||||||||||||||||||||||||||||
| 288 | { | ||||||||||||||||||||||||||||
| 289 | 7 | $meta->register_hook( | |||||||||||||||||||||||||||
| 290 | "test_system" => $instr, | ||||||||||||||||||||||||||||
| 291 | ); | ||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | else | ||||||||||||||||||||||||||||
| 294 | { | ||||||||||||||||||||||||||||
| 295 | 0 | die "unknown phase: $phase"; | |||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | 57 | my %modifiers = ( | |||||||||||||||||||||||||||
| 301 | probe => { any => 'probe' }, | ||||||||||||||||||||||||||||
| 302 | download => { share => 'download' }, | ||||||||||||||||||||||||||||
| 303 | fetch => { share => 'fetch' }, | ||||||||||||||||||||||||||||
| 304 | decode => { share => 'fetch' }, | ||||||||||||||||||||||||||||
| 305 | prefer => { share => 'prefer' }, | ||||||||||||||||||||||||||||
| 306 | extract => { share => 'extract' }, | ||||||||||||||||||||||||||||
| 307 | patch => { share => 'patch$' }, | ||||||||||||||||||||||||||||
| 308 | build => { share => 'build$' }, | ||||||||||||||||||||||||||||
| 309 | test => { share => 'test$' }, | ||||||||||||||||||||||||||||
| 310 | # Note: below special case gather_ffi for the ffi block :P | ||||||||||||||||||||||||||||
| 311 | gather => { share => 'gather_share', system => 'gather_system', any => 'gather_share,gather_system' }, | ||||||||||||||||||||||||||||
| 312 | ); | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | sub _add_modifier | ||||||||||||||||||||||||||||
| 315 | 20 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_add_modifier: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||
| 316 | 20 | my($type, $stage, $sub) = @_; | |||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | 20 | my $method = "${type}_hook"; | |||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 20 | ▶ | Carp::croak "No such stage $stage" unless defined $modifiers{$stage}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 321 | 18 | ▶ | Carp::croak "$type $stage argument must be a code reference" unless defined $sub && ref($sub) eq 'CODE'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $sub and ref $sub eq "CODE"
MC/DC50%1/2
defined $sub and ref $sub eq "CODE"
defined $sub
ref $sub eq "CODE"
Truth table66%2/3
A and B
A= defined $subB= ref $sub eq "CODE"
| |||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | 16 | my $caller = caller; | |||||||||||||||||||||||||||
| 324 | 16 | my $meta = $caller->meta; | |||||||||||||||||||||||||||
| 325 | 16 | ▶ | Carp::croak "$type $stage is not allowed in sys block" unless defined $modifiers{$stage}->{$meta->{phase}}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 14 | $meta->add_requires('configure' => 'Alien::Build' => '1.40'); | |||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | 14 | my $suffix = $meta->{build_suffix}; | |||||||||||||||||||||||||||
| 330 | 14 | ▶ | if($suffix eq '_ffi' && $stage eq 'gather') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$suffix eq "_ffi" and $stage eq "gather"
MC/DC100%2/2
$suffix eq "_ffi" and $stage eq "gather"
$suffix eq "_ffi"
$stage eq "gather"
Truth table100%3/3
A and B
A= $suffix eq "_ffi"B= $stage eq "gather"
| |||||||||||||||||||||||||||||
| 331 | { | ||||||||||||||||||||||||||||
| 332 | 2 | $meta->$method('gather_ffi' => $sub); | |||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | 14 | foreach my $hook ( | |||||||||||||||||||||||||||
| 336 | 14 | map { split /,/, $_ } # split on , for when multiple hooks must be attached (gather in any) | |||||||||||||||||||||||||||
| 337 | 14 | map { my $x = $_ ; $x =~ s/\$/$suffix/; $x } # substitute $ at the end for a suffix (_ffi) if any | |||||||||||||||||||||||||||
| 338 | $modifiers{$stage}->{$meta->{phase}}) # get the list of modifiers | ||||||||||||||||||||||||||||
| 339 | { | ||||||||||||||||||||||||||||
| 340 | 16 | $meta->$method($hook => $sub); | |||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | 14 | return; | |||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | sub before | ||||||||||||||||||||||||||||
| 347 | 10 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
before: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 348 | 10 | my($stage, $sub) = @_; | |||||||||||||||||||||||||||
| 349 | 10 | @_ = ('before', @_); | |||||||||||||||||||||||||||
| 350 | 10 | goto &alienfile::_add_modifier; | |||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | sub after | ||||||||||||||||||||||||||||
| 355 | 10 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
after: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 356 | 10 | my($stage, $sub) = @_; | |||||||||||||||||||||||||||
| 357 | 10 | @_ = ('after', @_); | |||||||||||||||||||||||||||
| 358 | 10 | goto &alienfile::_add_modifier; | |||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | sub import | ||||||||||||||||||||||||||||
| 362 | 346 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 363 | 346 | strict->import; | |||||||||||||||||||||||||||
| 364 | 346 | warnings->import; | |||||||||||||||||||||||||||
| 365 | 346 | goto &Exporter::import; | |||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 57 | 1; | |||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | __END__ | ||||||||||||||||||||||||||||