blib/lib/Inline.pm

filter: Statementstmt 89.0% 568 / 638 Branchbran 50.5% 185 / 366 Conditioncond 43.5% 74 / 170 MC/DCmcdc 6.8% 6 / 88 Subroutinesub 100% 63 / 63 Podpod 11.1% 3 / 27 totaltotal 66.4% 899 / 1352 CC 252 SCAR 40.8
CC
252
Cov
70%
find_temp_dir
321.0
create_config_file
97.8
check_installed
52.8
CRAP 59.2
« blib/lib/Inline/C/ParseRegExp.pm ↑ Summary blib/lib/Inline/MakeMaker.pm »
1 package Inline;
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 require 5.006;
5 5 $Inline::VERSION = '0.54_02';
6 5 $Inline::VERSION = eval $Inline::VERSION;
7  
8 8 ▶use AutoLoader 'AUTOLOAD';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 ▶use Inline::denter;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 8 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 8 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 8 ▶use Cwd qw(abs_path cwd);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 8 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 8 ▶use File::Spec::Unix;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 8 ▶use Fcntl qw(LOCK_EX LOCK_UN);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 5 my %CONFIG = ();
18 5 my @DATA_OBJS = ();
19 5 my $INIT = 0;
20 5 my $version_requested = 0;
21 5 my $version_printed = 0;
22 5 my $untaint = 0;
23 5 my $safemode = 0;
24 5 $Inline::languages = undef; #needs to be global for AutoLoaded error messages
25  
26 5 our $did = '_Inline'; # Default Inline Directory
27  
28 # This is the config file written by create_config_file().
29 5 our $configuration_file = 'config-' . $Config::Config{'archname'} . '-' . $];
30  
31 5 my %shortcuts =
32 (
33 NOCLEAN => [CLEAN_AFTER_BUILD => 0],
34 CLEAN => [CLEAN_BUILD_AREA => 1],
35 FORCE => [FORCE_BUILD => 1],
36 INFO => [PRINT_INFO => 1],
37 VERSION => [PRINT_VERSION => 1],
38 REPORTBUG => [REPORTBUG => 1],
39 UNTAINT => [UNTAINT => 1],
40 SAFE => [SAFEMODE => 1],
41 UNSAFE => [SAFEMODE => 0],
42 GLOBAL => [GLOBAL_LOAD => 1],
43 NOISY => [BUILD_NOISY => 1],
44 TIMERS => [BUILD_TIMERS => 1],
45 NOWARN => [WARNINGS => 0],
46 _INSTALL_ => [_INSTALL_ => 1],
47 SITE_INSTALL => undef, # No longer supported.
48 );
49  
50 5 my $default_config =
51 {
52 NAME => '',
53 AUTONAME => -1,
54 VERSION => '',
55 DIRECTORY => '',
56 WITH => [],
57 USING => [],
58  
59 CLEAN_AFTER_BUILD => 1,
60 CLEAN_BUILD_AREA => 0,
61 FORCE_BUILD => 0,
62 PRINT_INFO => 0,
63 PRINT_VERSION => 0,
64 REPORTBUG => 0,
65 UNTAINT => 0,
66 NO_UNTAINT_WARN => 0,
67 REWRITE_CONFIG_FILE => 0,
68 SAFEMODE => -1,
69 GLOBAL_LOAD => 0,
70 BUILD_NOISY => 0,
71 BUILD_TIMERS => 0,
72 WARNINGS => 1,
73 _INSTALL_ => 0,
74 _TESTING => 0,
75 };
76  
77 100 ▶sub UNTAINT {$untaint}
Subroutine UNTAINT: called CC=1 SCAR=0.0
Pod documented
78 6 ▶sub SAFEMODE {$safemode}
Subroutine SAFEMODE: called CC=1 SCAR=0.0
Pod documented
79  
80 #==============================================================================
81 # This is where everything starts.
82 #==============================================================================
83 sub import {
84 21 ▶ local ($/, $") = ("\n", ' '); local ($\, $,);
Subroutine import: called CC=23 SCAR=33.3
85  
86 21 my $o;
87 21 my ($pkg, $script) = caller;
88 # Not sure what this is for. Let's see what breaks.
89 # $pkg =~ s/^.*[\/\\]//;
90 21 my $class = shift;
91 24 ▶ if ($class ne 'Inline') {
Branch: 1 branch
BranchTrueFalseTotal
if ($class ne "Inline") 0 27 27
92 3 ▶ croak M01_usage_use($class) if $class =~ /^Inline::/;
Branch: 1 branch
BranchTrueFalseTotal
if $class =~ /^Inline::/ 0 0 0
93 3 croak M02_usage();
94 }
95  
96 24 ▶ $CONFIG{$pkg}{template} ||= $default_config;
Condition66%2/3
$CONFIG{$pkg}{"template"} ||= $default_config
l!l&&r!l&&!r
1980
MC/DC0%0/2
$CONFIG{$pkg}{"template"} ||= $default_config
$CONFIG{$pkg}{"template"} $default_config
Truth table66%2/3
A ||= B
A= $CONFIG{$pkg}{"template"}B= $default_config
ABresult
1X1
011
000
97  
98 24 ▶ return unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 27 27
99 21 ▶ &create_config_file(), return 1 if $_[0] eq '_CONFIG_';
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] eq "_CONFIG_" 0 27 27
100 21 ▶ goto &maker_utils if $_[0] =~ /^(install|makedist|makeppd)$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] =~ /^(install|makedist|makeppd)$/i 0 27 27
101  
102 24 my $control = shift;
103  
104 24 ▶ if ($control eq 'with') {
Branch: 4 branches
BranchTrueFalseTotal
if ($control eq 'with') { } 0 27 27
elsif ($control eq 'Config') { } 9 18 27
elsif (exists $shortcuts{uc $control}) { } 1 17 18
elsif ($control =~ /^\S+$/ and not $control =~ /\n/) { } 17 0 17
105 3 return handle_with($pkg, @_);
106 }
107 elsif ($control eq 'Config') {
108 9 return handle_global_config($pkg, @_);
109 }
110 elsif (exists $shortcuts{uc($control)}) {
111 4 handle_shortcuts($pkg, $control, @_);
112 3 $version_requested = $CONFIG{$pkg}{template}{PRINT_VERSION};
113 0 return;
114 }
115 ▶ elsif ($control =~ /^\S+$/ and $control !~ /\n/) {
Condition33%1/3
$control =~ /^\S+$/ and not $control =~ /\n/
!ll&&!rl&&r
0017
MC/DC0%0/2
$control =~ /^\S+$/ and not $control =~ /\n/
$control =~ /^\S+$/ not $control =~ /\n/
Truth table33%1/3
A and not(B)
A= $control =~ /^\S+$/B= not $control =~ /\n/
ABresult
0X0
100
111
116 14 my $language_id = $control;
117 16 ▶ my $option = shift || '';
Condition100%2/2
shift() || ''
l!l
134
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
118 16 my @config = @_;
119 16 my $next = 0;
120 14 for (@config) {
121 8 ▶ next if $next++ % 2;
Branch: 1 branch
BranchTrueFalseTotal
if $next++ % 2 4 4 8
122 5 ▶ croak M02_usage() if /[\s\n]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[\s\n]/ 0 4 4
123 }
124 15 $o = bless {}, $class;
125 14 $o->{INLINE}{version} = $Inline::VERSION;
126 15 $o->{API}{pkg} = $pkg;
127 15 $o->{API}{script} = $script;
128 15 $o->{API}{language_id} = $language_id;
129 15 ▶ if ($option =~ /^(FILE|BELOW)$/ or
Branch: 3 branches
BranchTrueFalseTotal
if ($option =~ /^(FILE|BELOW)$/ or not $option and defined $INC{'File::Spec::Unix'->catfile('Inline', 'Files.pm')} and Inline::Files::get_filename($pkg)) { } 0 17 17
elsif ($option eq 'DATA' or not $option) { } 7 10 17
elsif ($option eq 'Config') { } 1 9 10
Condition44%4/9
$option =~ /^(FILE|BELOW)$/ or not $option and defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and Inline::Files::get_filename($pkg)
l!l&&r!l&&!r
0017
not $option and defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and Inline::Files::get_filename($pkg)
!ll&&!rl&&r
1700
not $option and defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")}
!ll&&!rl&&r
1340
MC/DC0%0/4
$option =~ /^(FILE|BELOW)$/ or not $option and defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and Inline::Files::get_filename($pkg)
$option =~ /^(FILE|BELOW)$/ not $option defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} Inline::Files::get_filename($pkg)
Truth table40%2/5
A or not(B) and C and D
A= $option =~ /^(FILE|BELOW)$/B= not $optionC= defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")}D= Inline::Files::get_filename($pkg)
ABCDresult
1XXX1
01111
00XX0
010X0
01100
130 not $option and
131 defined $INC{File::Spec::Unix->catfile('Inline','Files.pm')} and
132 Inline::Files::get_filename($pkg)
133 ) {
134 1 $o->read_inline_file;
135 1 $o->{CONFIG} = handle_language_config(@config);
136 }
137 ▶ elsif ($option eq 'DATA' or not $option) {
Condition100%3/3
$option eq "DATA" or not $option
l!l&&r!l&&!r
3410
MC/DC100%2/2
$option eq "DATA" or not $option
$option eq "DATA" not $option
Truth table100%3/3
A or not(B)
A= $option eq "DATA"B= not $option
ABresult
1X1
011
000
138 6 $o->{CONFIG} = handle_language_config(@config);
139 6 push @DATA_OBJS, $o;
140 6 return;
141 }
142 elsif ($option eq 'Config') {
143 2 $CONFIG{$pkg}{$language_id} = handle_language_config(@config);
144 2 return;
145 }
146 else {
147 9 $o->receive_code($option);
148 9 $o->{CONFIG} = handle_language_config(@config);
149 }
150 }
151 else {
152 1 croak M02_usage();
153 }
154 9 $o->glue;
155 }
156  
157 #==============================================================================
158 # Run time version of import (public method)
159 #==============================================================================
160 sub bind {
161 1 ▶ local ($/, $") = ("\n", ' '); local ($\, $,);
Subroutine bind: called CC=10 SCAR=25.6
Pod documented
162  
163 2 my ($code, @config);
164 2 my $o;
165 2 my ($pkg, $script) = caller;
166 2 my $class = shift;
167 2 ▶ croak M03_usage_bind() unless $class eq 'Inline';
Branch: 1 branch
BranchTrueFalseTotal
unless $class eq "Inline" 0 2 2
168  
169 2 ▶ $CONFIG{$pkg}{template} ||= $default_config;
Condition33%1/3
$CONFIG{$pkg}{"template"} ||= $default_config
l!l&&r!l&&!r
200
MC/DC0%0/2
$CONFIG{$pkg}{"template"} ||= $default_config
$CONFIG{$pkg}{"template"} $default_config
Truth table33%1/3
A ||= B
A= $CONFIG{$pkg}{"template"}B= $default_config
ABresult
1X1
011
000
170  
171 2 ▶ my $language_id = shift or croak M03_usage_bind();
Branch: 1 branch
BranchTrueFalseTotal
my $language_id = shift() or croak(M03_usage_bind()) 0 2 2
172 2 ▶ croak M03_usage_bind()
Branch: 1 branch
BranchTrueFalseTotal
unless $language_id =~ /^\S+$/ and not $language_id =~ /\n/ 0 2 2
Condition33%1/3
$language_id =~ /^\S+$/ and not $language_id =~ /\n/
!ll&&!rl&&r
002
MC/DC0%0/2
$language_id =~ /^\S+$/ and not $language_id =~ /\n/
$language_id =~ /^\S+$/ not $language_id =~ /\n/
Truth table33%1/3
A and not(B)
A= $language_id =~ /^\S+$/B= not $language_id =~ /\n/
ABresult
0X0
100
111
173 unless ($language_id =~ /^\S+$/ and $language_id !~ /\n/);
174 2 ▶ $code = shift or croak M03_usage_bind();
Branch: 1 branch
BranchTrueFalseTotal
$code = shift() or croak(M03_usage_bind()) 0 2 2
175 2 @config = @_;
176  
177 2 my $next = 0;
178 3 for (@config) {
179 2 ▶ next if $next++ % 2;
Branch: 1 branch
BranchTrueFalseTotal
if $next++ % 2 0 0 0
180 0 ▶ croak M03_usage_bind() if /[\s\n]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[\s\n]/ 0 0 0
181 }
182 1 $o = bless {}, $class;
183 5 $o->{INLINE}{version} = $Inline::VERSION;
184 5 $o->{API}{pkg} = $pkg;
185 5 $o->{API}{script} = $script;
186 5 $o->{API}{language_id} = $language_id;
187 5 $o->receive_code($code);
188 5 $o->{CONFIG} = handle_language_config(@config);
189  
190 5 $o->glue;
191 }
192  
193 #==============================================================================
194 # Process delayed objects that don't have source code yet.
195 #==============================================================================
196 # This code is an ugly hack because of the fact that you can't use an
197 # INIT block at "run-time proper". So we kill the warning and tell users
198 # to use an Inline->init() call if they run into problems. (rare)
199  
200 8 ▶eval <<END;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine INIT: called CC=1 SCAR=0.0
201 no warnings;
202 \$INIT = \$INIT; # Needed by Sarathy's patch.
203 sub INIT {
204 \$INIT++;
205 &init;
206 }
207 END
208  
209 sub init {
210 10 ▶ local ($/, $") = ("\n", ' '); local ($\, $,);
Subroutine init: called CC=2 SCAR=6.9
Pod undocumented
211  
212 10 ▶ while (my $o = shift(@DATA_OBJS)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @DATA_OBJS) 7 7 14
213 9 $o->read_DATA;
214 9 $o->glue;
215 }
216 }
217  
218 sub END {
219 13 ▶ warn M51_unused_DATA() if @DATA_OBJS;
Subroutine END: called CC=4 SCAR=16.9
Branch: 1 branch
BranchTrueFalseTotal
if @DATA_OBJS 0 8 8
220 13 ▶ print_version() if $version_requested && not $version_printed;
Branch: 1 branch
BranchTrueFalseTotal
if $version_requested and not $version_printed 0 8 8
Condition33%1/3
$version_requested and not $version_printed
!ll&&!rl&&r
800
MC/DC0%0/2
$version_requested and not $version_printed
$version_requested not $version_printed
Truth table33%1/3
A and not(B)
A= $version_requestedB= not $version_printed
ABresult
0X0
100
111
221 }
222  
223 #==============================================================================
224 # Print a small report about the version of Inline
225 #==============================================================================
226 sub print_version {
227 4 ▶ return if $version_printed++;
Subroutine print_version: called CC=2 SCAR=9.2
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if $version_printed++ 0 0 0
228 4 print STDERR <<END;
229  
230 You are using Inline.pm version $Inline::VERSION
231  
232 END
233 }
234  
235 #==============================================================================
236 # Compile the source if needed and then dynaload the object
237 #==============================================================================
238 sub glue {
239 18 ▶ my $o = shift;
Subroutine glue: called CC=23 SCAR=35.6
Pod undocumented
240 18 my ($pkg, $language_id) = @{$o->{API}}{qw(pkg language_id)};
241 18 my @config = (%{$CONFIG{$pkg}{template}},
242 18 ▶ %{$CONFIG{$pkg}{$language_id} || {}},
Branch: 1 branch
BranchTrueFalseTotal
$CONFIG{$pkg}{$language_id} or {} 17 1 18
243 18 ▶ %{$o->{CONFIG} || {}},
Branch: 1 branch
BranchTrueFalseTotal
$o->{"CONFIG"} or {} 0 18 18
244 );
245 18 @config = $o->check_config(@config);
246 18 $o->fold_options;
247  
248 18 $o->check_installed;
249 18 ▶ $o->env_untaint if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 4 14 18
250 18 ▶ if (not $o->{INLINE}{object_ready}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($o->{"INLINE"}{"object_ready"}) 18 0 18
251 18 $o->check_config_file; # Final DIRECTORY set here.
252 12 push @config, $o->with_configs;
253 12 my $language = $o->{API}{language};
254 16 ▶ croak M04_error_nocode($language_id) unless $o->{API}{code};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"API"}{"code"} 0 16 16
255 16 $o->check_module;
256 }
257 16 ▶ $o->env_untaint if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 4 12 16
258 16 ▶ $o->obj_untaint if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 4 12 16
259 16 ▶ print_version() if $version_requested;
Branch: 1 branch
BranchTrueFalseTotal
if $version_requested 0 16 16
260 12 ▶ $o->reportbug() if $o->{CONFIG}{REPORTBUG};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"REPORTBUG"} 0 16 16
261 12 ▶ if (not $o->{INLINE}{object_ready}
Branch: 1 branch
BranchTrueFalseTotal
if (not $o->{'INLINE'}{'object_ready'} or $o->{'CONFIG'}{'PRINT_INFO'}) { } 16 0 16
Condition33%1/3
not $o->{"INLINE"}{"object_ready"} or $o->{"CONFIG"}{"PRINT_INFO"}
l!l&&r!l&&!r
1600
MC/DC0%0/2
not $o->{"INLINE"}{"object_ready"} or $o->{"CONFIG"}{"PRINT_INFO"}
not $o->{"INLINE"}{"object_ready"} $o->{"CONFIG"}{"PRINT_INFO"}
Truth table33%1/3
not(A) or B
A= not $o->{"INLINE"}{"object_ready"}B= $o->{"CONFIG"}{"PRINT_INFO"}
ABresult
1X1
011
000
262 or $o->{CONFIG}{PRINT_INFO}
263 ) {
264 12 eval "require $o->{INLINE}{ILSM_module}";
265 12 ▶ croak M05_error_eval('glue', $@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 16 16
266 12 $o->push_overrides;
267 16 bless $o, $o->{INLINE}{ILSM_module};
268 16 $o->validate(@config);
269 }
270 else {
271 4 $o->{CONFIG} = {(%{$o->{CONFIG}}, @config)};
272 }
273 15 ▶ $o->print_info if $o->{CONFIG}{PRINT_INFO};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"PRINT_INFO"} 0 15 15
274 15 ▶ unless ($o->{INLINE}{object_ready} or
Branch: 1 branch
BranchTrueFalseTotal
unless ($o->{"INLINE"}{"object_ready"} or not length $o->{"INLINE"}{"ILSM_suffix"}) 15 0 15
Condition33%1/3
$o->{"INLINE"}{"object_ready"} or not length $o->{"INLINE"}{"ILSM_suffix"}
l!l&&r!l&&!r
0015
MC/DC0%0/2
$o->{"INLINE"}{"object_ready"} or not length $o->{"INLINE"}{"ILSM_suffix"}
$o->{"INLINE"}{"object_ready"} not length $o->{"INLINE"}{"ILSM_suffix"}
Truth table33%1/3
A or not(B)
A= $o->{"INLINE"}{"object_ready"}B= not length $o->{"INLINE"}{"ILSM_suffix"}
ABresult
1X1
011
000
275 not length $o->{INLINE}{ILSM_suffix}) {
276 15 $o->build();
277 11 ▶ $o->write_inl_file() unless $o->{CONFIG}{_INSTALL_};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"_INSTALL_"} 15 0 15
278 }
279 11 ▶ if ($o->{INLINE}{ILSM_suffix} ne 'so' and
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"INLINE"}{"ILSM_suffix"} ne "so" and $o->{"INLINE"}{"ILSM_suffix"} ne "dll" and $o->{"INLINE"}{"ILSM_suffix"} ne "bundle" and $o->{"INLINE"}{"ILSM_suffix"} ne "sl" and ref $o eq "Inline") 0 15 15
Condition66%8/12
$o->{"INLINE"}{"ILSM_suffix"} ne "so" and $o->{"INLINE"}{"ILSM_suffix"} ne "dll" and $o->{"INLINE"}{"ILSM_suffix"} ne "bundle" and $o->{"INLINE"}{"ILSM_suffix"} ne "sl" and ref $o eq "Inline"
!ll&&!rl&&r
4110
$o->{"INLINE"}{"ILSM_suffix"} ne "so" and $o->{"INLINE"}{"ILSM_suffix"} ne "dll" and $o->{"INLINE"}{"ILSM_suffix"} ne "bundle" and $o->{"INLINE"}{"ILSM_suffix"} ne "sl"
!ll&&!rl&&r
4011
$o->{"INLINE"}{"ILSM_suffix"} ne "so" and $o->{"INLINE"}{"ILSM_suffix"} ne "dll" and $o->{"INLINE"}{"ILSM_suffix"} ne "bundle"
!ll&&!rl&&r
4011
$o->{"INLINE"}{"ILSM_suffix"} ne "so" and $o->{"INLINE"}{"ILSM_suffix"} ne "dll"
!ll&&!rl&&r
4011
MC/DC0%0/5
$o->{"INLINE"}{"ILSM_suffix"} ne "so" and $o->{"INLINE"}{"ILSM_suffix"} ne "dll" and $o->{"INLINE"}{"ILSM_suffix"} ne "bundle" and $o->{"INLINE"}{"ILSM_suffix"} ne "sl" and ref $o eq "Inline"
$o->{"INLINE"}{"ILSM_suffix"} ne "so" $o->{"INLINE"}{"ILSM_suffix"} ne "dll" $o->{"INLINE"}{"ILSM_suffix"} ne "bundle" $o->{"INLINE"}{"ILSM_suffix"} ne "sl" ref $o eq "Inline"
Truth table33%2/6
A and B and C and D and E
A= $o->{"INLINE"}{"ILSM_suffix"} ne "so"B= $o->{"INLINE"}{"ILSM_suffix"} ne "dll"C= $o->{"INLINE"}{"ILSM_suffix"} ne "bundle"D= $o->{"INLINE"}{"ILSM_suffix"} ne "sl"E= ref $o eq "Inline"
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
280 $o->{INLINE}{ILSM_suffix} ne 'dll' and
281 $o->{INLINE}{ILSM_suffix} ne 'bundle' and
282 $o->{INLINE}{ILSM_suffix} ne 'sl' and
283 ref($o) eq 'Inline'
284 ) {
285 0 eval "require $o->{INLINE}{ILSM_module}";
286 0 ▶ croak M05_error_eval('glue', $@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
287 0 $o->push_overrides;
288 0 bless $o, $o->{INLINE}{ILSM_module};
289 0 $o->validate(@config);
290 }
291 11 $o->load;
292 11 $o->pop_overrides;
293 }
294  
295 #==============================================================================
296 # Set up the USING overrides
297 #==============================================================================
298 sub push_overrides {
299 12 ▶ my ($o) = @_;
Subroutine push_overrides: called CC=8 SCAR=22.9
Pod undocumented
300 12 my ($language_id) = $o->{API}{language_id};
301 12 my ($ilsm) = $o->{INLINE}{ILSM_module};
302 12 for (@{$o->{CONFIG}{USING}}) {
303 0 ▶ my $using_module = /^::/
Branch: 2 branches
BranchTrueFalseTotal
/^::/ ? : 0 0 0
/::/ ? : 0 0 0
304 ? "Inline::$language_id$_"
305 : /::/
306 ? $_
307 : "Inline::${language_id}::$_";
308 4 eval "require $using_module";
309 4 ▶ croak "Invalid module '$using_module' in USING list:\n$@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
310 2 my $register;
311 2 eval "\$register = $using_module->register";
312 2 ▶ croak "Invalid module '$using_module' in USING list:\n$@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
313 2 for my $override (@{$register->{overrides}}) {
314 8 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
315 2 ▶ next if defined $o->{OVERRIDDEN}{$ilsm . "::$override"};
Branch: 1 branch
BranchTrueFalseTotal
if defined $o->{"OVERRIDDEN"}{$ilsm . "::$override"} 0 0 0
316 $o->{OVERRIDDEN}{$ilsm . "::$override"} =
317 1 \&{$ilsm . "::$override"};
318 {
319 8 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
320 1 *{$ilsm . "::$override"} =
321 1 \&{$using_module . "::$override"};
322 }
323 }
324 }
325 }
326  
327 #==============================================================================
328 # Restore the modules original methods
329 #==============================================================================
330 sub pop_overrides {
331 12 ▶ my $nowarn = $] >= 5.006 ? "no warnings 'redefine';" : '';
Subroutine pop_overrides: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$] >= 5.006 ? : 15 0 15
332 5 ▶ eval ($nowarn .
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
333 'my ($o) = @_;
334 for my $override (keys %{$o->{OVERRIDDEN}}) {
335 no strict "refs";
336 *{$override} = $o->{OVERRIDDEN}{$override};
337 }
338 delete $o->{OVERRIDDEN};')
339 }
340  
341 #==============================================================================
342 # Get source from the DATA filehandle
343 #==============================================================================
344 5 my (%DATA, %DATA_read);
345 sub read_DATA {
346 6 ▶ require Socket;
Subroutine read_DATA: called CC=6 SCAR=18.0
Pod undocumented
347 6 my ($marker, $marker_tag);
348 7 my $o = shift;
349 7 my ($pkg, $language_id) = @{$o->{API}}{qw(pkg language_id)};
350 7 ▶ unless ($DATA_read{$pkg}++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($DATA_read{$pkg}++) 4 3 7
351 8 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
352 5 *Inline::DATA = *{$pkg . '::DATA'};
353 7 local ($/);
354 7 my ($CR, $LF) = (&Socket::CR, &Socket::LF);
355 91 (my $data = <Inline::DATA>) =~ s/$CR?$LF/\n/g;
356 91 @{$DATA{$pkg}} = split /(?m)^[ \t]{0,}(__\S+?__\n)/, $data;
357 11 ▶ shift @{$DATA{$pkg}} unless ($ {$DATA{$pkg}}[0] || '') =~ /__\S+?__\n/;
Branch: 1 branch
BranchTrueFalseTotal
unless (do { $DATA{$pkg} }->[0] || "") =~ /__\S+?__\n/ 4 0 4
Condition50%1/2
do { $DATA{$pkg} }->[0] || ''
l!l
40
MC/DC0%0/1
do { $DATA{$pkg} }->[0] || ''
do { $DATA{$pkg} }->[0]
Truth table50%1/2
A
A= do { $DATA{$pkg} }->[0]
Aresult
11
00
358 }
359 13 ($marker, $o->{API}{code}) = splice @{$DATA{$pkg}}, 0, 2;
360 29 ▶ croak M08_no_DATA_source_code($language_id)
Branch: 1 branch
BranchTrueFalseTotal
unless defined $marker 0 7 7
361 unless defined $marker;
362 9 ($marker_tag = $marker) =~ s/__(\S+?)__\n/$1/;
363 9 ▶ croak M09_marker_mismatch($marker, $language_id)
Branch: 1 branch
BranchTrueFalseTotal
unless $marker_tag eq $language_id 0 7 7
364 unless $marker_tag eq $language_id;
365 }
366  
367 #==============================================================================
368 # Validate and store the non language-specific config options
369 #==============================================================================
370 sub check_config {
371 14 ▶ my $o = shift;
Subroutine check_config: called CC=14 SCAR=28.1
Pod undocumented
372 14 my @others;
373 38 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 400 18 418
374 312 my ($key, $value) = (shift, shift);
375 316 ▶ if (defined $default_config->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $default_config->{$key}) { } 396 4 400
376 312 ▶ if ($key =~ /^(WITH|USING)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key =~ /^(WITH|USING)$/) 36 360 396
377 32 ▶ croak M10_usage_WITH_USING()
Branch: 1 branch
BranchTrueFalseTotal
if ref $value and ref $value ne "ARRAY" 0 36 36
Condition33%1/3
ref $value and ref $value ne "ARRAY"
!ll&&!rl&&r
0360
MC/DC0%0/2
ref $value and ref $value ne "ARRAY"
ref $value ref $value ne "ARRAY"
Truth table33%1/3
A and B
A= ref $valueB= ref $value ne "ARRAY"
ABresult
0X0
100
111
378 if (ref $value and ref $value ne 'ARRAY');
379 32 ▶ $value = [$value] unless ref $value;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value 0 36 36
380 32 $o->{CONFIG}{$key} = $value;
381 28 next;
382 }
383 280 ▶ $o->{CONFIG}{$key} = $value, next if not $value;
Branch: 1 branch
BranchTrueFalseTotal
unless $value 263 97 360
384 77 ▶ if ($key eq 'DIRECTORY') {
Branch: 3 branches
BranchTrueFalseTotal
if ($key eq 'DIRECTORY') { } 17 80 97
elsif ($key eq 'NAME') { } 0 80 80
elsif ($key eq 'VERSION') { } 0 80 80
385 17 ▶ croak M11_usage_DIRECTORY($value) unless (-d $value);
Branch: 1 branch
BranchTrueFalseTotal
unless -d $value 0 17 17
386 17 $value = abs_path($value);
387 }
388 elsif ($key eq 'NAME') {
389 4 ▶ croak M12_usage_NAME($value)
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /^[a-zA-Z_](\w|::)*$/ 0 0 0
390 unless $value =~ /^[a-zA-Z_](\w|::)*$/;
391 }
392 elsif ($key eq 'VERSION') {
393 4 ▶ croak M13_usage_VERSION($value) unless $value =~ /^\d\.\d\d*$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /^\d\.\d\d*$/ 0 0 0
394 }
395 77 $o->{CONFIG}{$key} = $value;
396 }
397 else {
398 4 push @others, $key, $value;
399 }
400 }
401 18 return (@others);
402 }
403  
404 #==============================================================================
405 # Set option defaults based on current option settings.
406 #==============================================================================
407 sub fold_options {
408 18 ▶ my $o = shift;
Subroutine fold_options: called CC=13 SCAR=33.8
Pod undocumented
409  
410 # The following small section of code seems, to me, to be unnecessary - which is the
411 # reason that I've commented it out. I've left it here (including its associated comments)
412 # in case it later becomes evident that there *is* good reason to include it. --sisyphus
413 #
414 ## This bit tries to enable UNTAINT automatically if required when running the test suite.
415 # my $env_ha = $ENV{HARNESS_ACTIVE} || 0 ;
416 # my ($harness_active) = $env_ha =~ /(.*)/ ;
417 # if (($harness_active)&&(! $o->{CONFIG}{UNTAINT})){
418 # eval {
419 # require Scalar::Util;
420 # $o->{CONFIG}{UNTAINT} =
421 # (Scalar::Util::tainted(Cwd::cwd()) ? 1 : 0) ;
422 ## Disable SAFEMODE in the test suite, we know what we are doing...
423 # $o->{CONFIG}{SAFEMODE} = 0 ;
424 # warn "\n-[tT] enabled for test suite.
425 #Automatically setting UNTAINT=1 and SAFEMODE=0.\n"
426 # unless $Inline::_TAINT_WARNING_ ;
427 # $Inline::_TAINT_WARNING_ = 1 ;
428 # } ;
429 # }
430 ##
431 18 ▶ $untaint = $o->{CONFIG}{UNTAINT} || 0;
Condition100%2/2
$o->{'CONFIG'}{'UNTAINT'} || 0
l!l
414
MC/DC100%1/1
$o->{'CONFIG'}{'UNTAINT'} || 0
$o->{'CONFIG'}{'UNTAINT'}
Truth table100%2/2
A
A= $o->{'CONFIG'}{'UNTAINT'}
Aresult
11
00
432 $safemode = (($o->{CONFIG}{SAFEMODE} == -1) ?
433 ($untaint ? 1 : 0) :
434 $o->{CONFIG}{SAFEMODE}
435 18 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
$o->{'CONFIG'}{'SAFEMODE'} == -1 ? : 18 0 18
$untaint ? : 4 14 18
436 14 ▶ if (UNTAINT and
Branch: 1 branch
BranchTrueFalseTotal
if (UNTAINT() and SAFEMODE() and not $o->{"CONFIG"}{"DIRECTORY"}) 0 18 18
Condition66%4/6
UNTAINT() and SAFEMODE() and not $o->{"CONFIG"}{"DIRECTORY"}
!ll&&!rl&&r
1440
UNTAINT() and SAFEMODE()
!ll&&!rl&&r
1404
MC/DC0%0/3
UNTAINT() and SAFEMODE() and not $o->{"CONFIG"}{"DIRECTORY"}
UNTAINT() SAFEMODE() not $o->{"CONFIG"}{"DIRECTORY"}
Truth table50%2/4
A and B and not(C)
A= UNTAINT()B= SAFEMODE()C= not $o->{"CONFIG"}{"DIRECTORY"}
ABCresult
0XX0
10X0
1100
1111
437 SAFEMODE and
438 not $o->{CONFIG}{DIRECTORY}) {
439 0 ▶ croak M49_usage_unsafe(1) if ($< == 0 or $> == 0);
Branch: 1 branch
BranchTrueFalseTotal
if $< == 0 or $> == 0 0 0 0
Condition0%0/3
$< == 0 or $> == 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$< == 0 or $> == 0
$< == 0 $> == 0
Truth table0%0/3
A or B
A= $< == 0B= $> == 0
ABresult
1X1
011
000
440 0 ▶ warn M49_usage_unsafe(0) if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
441 }
442 14 ▶ if ($o->{CONFIG}{AUTONAME} == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"CONFIG"}{"AUTONAME"} == -1) 18 0 18
443 14 ▶ $o->{CONFIG}{AUTONAME} = length($o->{CONFIG}{NAME}) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
length $o->{'CONFIG'}{'NAME'} ? : 0 18 18
444 }
445 $o->{API}{cleanup} =
446 14 ▶ ($o->{CONFIG}{CLEAN_AFTER_BUILD} and not $o->{CONFIG}{REPORTBUG});
Condition33%1/3
$o->{'CONFIG'}{'CLEAN_AFTER_BUILD'} && !$o->{'CONFIG'}{'REPORTBUG'}
!ll&&!rl&&r
0018
MC/DC0%0/2
$o->{'CONFIG'}{'CLEAN_AFTER_BUILD'} && !$o->{'CONFIG'}{'REPORTBUG'}
$o->{'CONFIG'}{'CLEAN_AFTER_BUILD'} !$o->{'CONFIG'}{'REPORTBUG'}
Truth table33%1/3
A && not(B)
A= $o->{'CONFIG'}{'CLEAN_AFTER_BUILD'}B= !$o->{'CONFIG'}{'REPORTBUG'}
ABresult
0X0
100
111
447 }
448  
449 #==============================================================================
450 # Check if Inline extension is preinstalled
451 #==============================================================================
452 sub check_installed {
453 14 ▶ my $o = shift;
Subroutine check_installed: called CC=11 SCAR=39.7
Pod undocumented
454 14 $o->{INLINE}{object_ready} = 0;
455 14 ▶ unless ($o->{API}{code} =~ /^[A-Fa-f0-9]{32}$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{'API'}{'code'} =~ /^[A-Fa-f0-9]{32}$/) { } 0 18 18
456 14 require Digest::MD5;
457 14 $o->{INLINE}{md5} = Digest::MD5::md5_hex($o->{API}{code});
458 }
459 else {
460 0 $o->{INLINE}{md5} = $o->{API}{code};
461 }
462 14 ▶ return if $o->{CONFIG}{_INSTALL_};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"_INSTALL_"} 0 18 18
463 14 ▶ return unless $o->{CONFIG}{VERSION};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"VERSION"} 18 0 18
464 croak M26_error_version_without_name()
465 0 ▶ unless $o->{CONFIG}{NAME};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"NAME"} 0 0 0
466  
467 0 my @pkgparts = split(/::/, $o->{API}{pkg});
468 0 my $realname = File::Spec->catfile(@pkgparts) . '.pm';
469 0 my $realname_unix = File::Spec::Unix->catfile(@pkgparts) . '.pm';
470 0 ▶ my $realpath = $INC{$realname_unix}
Branch: 1 branch
BranchTrueFalseTotal
my $realpath = $INC{$realname_unix} or croak(M27_module_not_indexed($realname_unix)) 0 0 0
471 or croak M27_module_not_indexed($realname_unix);
472  
473 0 my ($volume,$dir,$file) = File::Spec->splitpath($realpath);
474 0 my @dirparts = File::Spec->splitdir($dir);
475 0 ▶ pop @dirparts unless $dirparts[-1];
Branch: 1 branch
BranchTrueFalseTotal
unless $dirparts[-1] 0 0 0
476 0 push @dirparts, $file;
477 0 my @endparts = splice(@dirparts, 0 - @pkgparts);
478  
479 0 ▶ $dirparts[-1] = 'arch'
Branch: 1 branch
BranchTrueFalseTotal
if $dirparts[-2] eq "blib" and $dirparts[-1] eq "lib" 0 0 0
Condition0%0/3
$dirparts[-2] eq "blib" and $dirparts[-1] eq "lib"
!ll&&!rl&&r
000
MC/DC0%0/2
$dirparts[-2] eq "blib" and $dirparts[-1] eq "lib"
$dirparts[-2] eq "blib" $dirparts[-1] eq "lib"
Truth table0%0/3
A and B
A= $dirparts[-2] eq "blib"B= $dirparts[-1] eq "lib"
ABresult
0X0
100
111
480 if $dirparts[-2] eq 'blib' && $dirparts[-1] eq 'lib';
481 0 ▶ File::Spec->catfile(@endparts) eq $realname
Branch: 1 branch
BranchTrueFalseTotal
"File::Spec"->catfile(@endparts) eq $realname or croak(M28_error_grokking_path($realpath)) 0 0 0
482 or croak M28_error_grokking_path($realpath);
483 0 $realpath =
484 File::Spec->catpath($volume,File::Spec->catdir(@dirparts),"");
485  
486 0 $o->{API}{version} = $o->{CONFIG}{VERSION};
487 4 $o->{API}{module} = $o->{CONFIG}{NAME};
488 4 my @modparts = split(/::/,$o->{API}{module});
489 0 $o->{API}{modfname} = $modparts[-1];
490 0 $o->{API}{modpname} = File::Spec->catdir(@modparts);
491  
492 0 my $suffix = $Config{dlext};
493 my $obj = File::Spec->catfile($realpath,'auto',$o->{API}{modpname},
494 0 "$o->{API}{modfname}.$suffix");
495 croak M30_error_no_obj($o->{CONFIG}{NAME}, $o->{API}{pkg},
496 0 ▶ $realpath) unless -f $obj;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $obj 0 0 0
497  
498 0 @{$o->{CONFIG}}{qw( PRINT_INFO
499 REPORTBUG
500 FORCE_BUILD
501 _INSTALL_
502 )} = (0, 0, 0, 0);
503  
504 4 $o->{install_lib} = $realpath;
505 4 $o->{INLINE}{ILSM_type} = 'compiled';
506 4 $o->{INLINE}{ILSM_module} = 'Inline::C';
507 4 $o->{INLINE}{ILSM_suffix} = $suffix;
508 4 $o->{INLINE}{object_ready} = 1;
509 }
510  
511 #==============================================================================
512 # Dynamically load the object module
513 #==============================================================================
514 sub load {
515 4 ▶ my $o = shift;
Subroutine load: called CC=7 SCAR=21.2
Pod undocumented
516  
517 4 ▶ if ($o->{CONFIG}{_INSTALL_}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"CONFIG"}{"_INSTALL_"}) 0 4 4
518 4 my $inline = "$o->{API}{modfname}.inl";
519 4 ▶ open INLINE, "> $inline"
Branch: 1 branch
BranchTrueFalseTotal
open INLINE, "> $inline" or croak(M24_open_for_output_failed($inline)) 0 0 0
520 or croak M24_open_for_output_failed($inline);
521 1 print INLINE "*** AUTOGENERATED by Inline.pm ***\n\n";
522 1 print INLINE "This file satisfies the make dependency for ";
523 1 print INLINE "$o->{API}{modfname}.pm\n";
524 1 close INLINE;
525 3 return;
526 }
527  
528 3 my ($pkg, $module) = @{$o->{API}}{qw(pkg module)};
529 6 ▶ croak M42_usage_loader() unless $o->{INLINE}{ILSM_type} eq 'compiled';
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"INLINE"}{"ILSM_type"} eq "compiled" 0 4 4
530  
531 6 require DynaLoader;
532 6 @Inline::ISA = qw(DynaLoader);
533  
534 6 ▶ my $global = $o->{CONFIG}{GLOBAL_LOAD} ? '0x01' : '0x00';
Branch: 1 branch
BranchTrueFalseTotal
$o->{'CONFIG'}{'GLOBAL_LOAD'} ? : 0 4 4
535 0 ▶ my $version = $o->{API}{version} || '0.00';
Condition50%1/2
$o->{'API'}{'version'} || '0.00'
l!l
04
MC/DC0%0/1
$o->{'API'}{'version'} || '0.00'
$o->{'API'}{'version'}
Truth table50%1/2
A
A= $o->{'API'}{'version'}
Aresult
11
00
536  
537 0 eval <<END;
538 package $pkg;
539 push \@$ {pkg}::ISA, qw($module)
540 unless \$module eq "$pkg";
541 local \$$ {module}::VERSION = '$version';
542  
543 package $module;
544 push \@$ {module}::ISA, qw(Exporter DynaLoader);
545 sub dl_load_flags { $global }
546 ${module}::->bootstrap;
547 END
548 6 ▶ croak M43_error_bootstrap($module, $@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 4 4
549 }
550  
551 #==============================================================================
552 # Process the config options that apply to all Inline sections
553 #==============================================================================
554 sub handle_global_config {
555 10 ▶ my $pkg = shift;
Subroutine handle_global_config: called CC=7 SCAR=20.8
Pod undocumented
556 10 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 15 9 24
557 9 my ($key, $value) = (shift, shift);
558 9 ▶ croak M02_usage() if $key =~ /[\s\n]/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /[\s\n]/ 0 15 15
559 9 ▶ $key = $value if $key =~ /^(ENABLE|DISABLE)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /^(ENABLE|DISABLE)$/ 0 15 15
560 croak M47_invalid_config_option($key)
561 9 ▶ unless defined $default_config->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $default_config->{$key} 0 15 15
562 9 ▶ if ($key eq 'ENABLE') {
Branch: 2 branches
BranchTrueFalseTotal
if ($key eq 'ENABLE') { } 0 15 15
elsif ($key eq 'DISABLE') { } 0 15 15
563 0 $CONFIG{$pkg}{template}{$value} = 1;
564 }
565 elsif ($key eq 'DISABLE') {
566 4 $CONFIG{$pkg}{template}{$value} = 0;
567 }
568 else {
569 9 $CONFIG{$pkg}{template}{$key} = $value;
570 }
571 }
572 }
573  
574 #==============================================================================
575 # Process the config options that apply to a particular language
576 #==============================================================================
577 sub handle_language_config {
578 15 ▶ my @values;
Subroutine handle_language_config: called CC=5 SCAR=16.4
Pod undocumented
579 15 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 4 19 23
580 4 my ($key, $value) = (shift, shift);
581 4 ▶ croak M02_usage() if $key =~ /[\s\n]/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /[\s\n]/ 0 4 4
582 4 ▶ if ($key eq 'ENABLE') {
Branch: 2 branches
BranchTrueFalseTotal
if ($key eq 'ENABLE') { } 3 1 4
elsif ($key eq 'DISABLE') { } 0 1 1
583 3 push @values, $value, 1;
584 }
585 elsif ($key eq 'DISABLE') {
586 0 push @values, $value, 0;
587 }
588 else {
589 1 push @values, $key, $value;
590 }
591 }
592 15 return {@values};
593 }
594  
595 #==============================================================================
596 # Validate and store shortcut config options
597 #==============================================================================
598 sub handle_shortcuts {
599 1 ▶ my $pkg = shift;
Subroutine handle_shortcuts: called CC=4 SCAR=14.0
Pod undocumented
600  
601 1 for my $option (@_) {
602 2 my $OPTION = uc($option);
603 2 ▶ if ($OPTION eq 'SITE_INSTALL') {
Branch: 2 branches
BranchTrueFalseTotal
if ($OPTION eq 'SITE_INSTALL') { } 0 2 2
elsif ($shortcuts{$OPTION}) { } 1 1 2
604 0 croak M58_site_install();
605 }
606 elsif ($shortcuts{$OPTION}) {
607 1 my ($method, $arg) = @{$shortcuts{$OPTION}};
608 5 $CONFIG{$pkg}{template}{$method} = $arg;
609 }
610 else {
611 5 croak M48_usage_shortcuts($option);
612 }
613 }
614 }
615  
616 #==============================================================================
617 # Process the with command
618 #==============================================================================
619 sub handle_with {
620 2 ▶ my $pkg = shift;
Subroutine handle_with: called CC=5 SCAR=26.5
Pod undocumented
621 2 ▶ croak M45_usage_with() unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
622 2 for (@_) {
623 2 ▶ croak M02_usage() unless /^[\w:]+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless /^[\w:]+$/ 0 0 0
624 0 eval "require $_;";
625 0 ▶ croak M46_usage_with_bad($_) . $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
626 0 push @{$CONFIG{$pkg}{template}{WITH}}, $_;
627 }
628 }
629  
630 #==============================================================================
631 # Perform cleanup duties
632 #==============================================================================
633 sub DESTROY {
634 15 ▶ my $o = shift;
Subroutine DESTROY: called CC=2 SCAR=7.2
635 15 ▶ $o->clean_build if $o->{CONFIG}{CLEAN_BUILD_AREA};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"CLEAN_BUILD_AREA"} 0 19 19
636 }
637  
638 # Comment out the next 2 lines to stop autoloading of subroutines (testing)
639 5 1;
640 __END__
« blib/lib/Inline/C/ParseRegExp.pm ↑ Summary blib/lib/Inline/MakeMaker.pm »