Inline.pm

filter: Statementstmt 52.3% 450 / 859 Branchbran 35.2% 157 / 446 Conditioncond 30.6% 65 / 212 MC/DCmcdc 5.3% 6 / 112 Subroutinesub 45.4% 60 / 132 Podpod 3.9% 4 / 101 totaltotal 39.8% 742 / 1862 CC 312 SCAR 41.7
CC
312
Cov
44%
find_temp_dir
347.3
create_config_file
246.8
_rmtree
210.0
CRAP 64.9
« Inline/MakeMaker.pm ↑ Summary Inline/denter.pm »
1 10 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Inline;
3  
4 10 our $VERSION = '0.87';
5  
6 10 ▶use Inline::denter;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use Cwd qw(abs_path cwd);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 10 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 10 ▶use File::Spec::Unix;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 10 ▶use Fcntl qw(LOCK_EX LOCK_SH O_WRONLY O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 10 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 10 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 10 ▶use constant CAN_FLOCK => !(
Subroutine BEGIN: called CC=3 SCAR=13.3
Condition33%2/6
$^O eq 'VMS' || $^O eq 'riscos' || $^O eq 'VOS'
l!l&&r!l&&!r
0010
$^O eq "VMS" or $^O eq "riscos"
l!l&&r!l&&!r
0010
MC/DC0%0/3
$^O eq 'VMS' || $^O eq 'riscos' || $^O eq 'VOS'
$^O eq "VMS" $^O eq "riscos" $^O eq 'VOS'
Truth table25%1/4
A or B || C
A= $^O eq "VMS"B= $^O eq "riscos"C= $^O eq 'VOS'
ABCresult
1XX1
01X1
0011
0000
18 $^O eq 'VMS' ||
19 $^O eq 'riscos' ||
20 $^O eq 'VOS'
21 10 );
22  
23 10 my %CONFIG = ();
24 10 my @DATA_OBJS = ();
25 10 my $INIT = 0;
26 10 my $version_requested = 0;
27 10 my $version_printed = 0;
28 10 my $untaint = 0;
29 10 my $safemode = 0;
30  
31 10 our $languages = undef;
32  
33 10 our $did = '_Inline'; # Default Inline Directory
34  
35 # This is the config file written by create_config_file().
36 10 our $configuration_file = 'config-' . $Config::Config{'archname'} . '-' . $];
37  
38 10 my %shortcuts =
39 (
40 NOCLEAN => [CLEAN_AFTER_BUILD => 0],
41 CLEAN => [CLEAN_BUILD_AREA => 1],
42 FORCE => [FORCE_BUILD => 1],
43 INFO => [PRINT_INFO => 1],
44 VERSION => [PRINT_VERSION => 1],
45 REPORTBUG => [REPORTBUG => 1],
46 UNTAINT => [UNTAINT => 1],
47 SAFE => [SAFEMODE => 1],
48 UNSAFE => [SAFEMODE => 0],
49 GLOBAL => [GLOBAL_LOAD => 1],
50 NOISY => [BUILD_NOISY => 1],
51 TIMERS => [BUILD_TIMERS => 1],
52 NOWARN => [WARNINGS => 0],
53 _INSTALL_ => [_INSTALL_ => 1],
54 SITE_INSTALL => undef, # No longer supported.
55 );
56  
57 10 my $default_config =
58 {
59 NAME => '',
60 AUTONAME => -1,
61 VERSION => '',
62 DIRECTORY => '',
63 WITH => [],
64 USING => [],
65  
66 CLEAN_AFTER_BUILD => 1,
67 CLEAN_BUILD_AREA => 0,
68 FORCE_BUILD => 0,
69 PRINT_INFO => 0,
70 PRINT_VERSION => 0,
71 REPORTBUG => 0,
72 UNTAINT => 0,
73 NO_UNTAINT_WARN => 0,
74 REWRITE_CONFIG_FILE => 0,
75 SAFEMODE => -1,
76 GLOBAL_LOAD => 0,
77 BUILD_NOISY => 0,
78 BUILD_TIMERS => 0,
79 WARNINGS => 1,
80 _INSTALL_ => 0,
81 _TESTING => 0,
82 };
83  
84 261 ▶sub UNTAINT {$untaint}
Subroutine UNTAINT: called CC=1 SCAR=0.0
Pod undocumented
85 5 ▶sub SAFEMODE {$safemode}
Subroutine SAFEMODE: called CC=1 SCAR=0.0
Pod undocumented
86  
87 #==============================================================================
88 # This is where everything starts.
89 #==============================================================================
90 33 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
91 36 my $class = shift;
92 36 $class->import_heavy(@_);
93 }
94  
95 32 ▶sub import_heavy {
Subroutine import_heavy: called CC=23 SCAR=32.5
Pod undocumented
96 33 local ($/, $") = ("\n", ' '); local ($\, $,);
97  
98 33 my $o;
99 33 my ($pkg, $script) = caller(1);
100 # Not sure what this is for. Let's see what breaks.
101 # $pkg =~ s/^.*[\/\\]//;
102 33 my $class = shift;
103 33 ▶ if ($class ne 'Inline') {
Branch: 1 branch
BranchTrueFalseTotal
if ($class ne "Inline") 0 31 31
104 1 ▶ croak M01_usage_use($class) if $class =~ /^Inline::/;
Branch: 1 branch
BranchTrueFalseTotal
if $class =~ /^Inline::/ 0 0 0
105 1 croak M02_usage();
106 }
107  
108 32 ▶ $CONFIG{$pkg}{template} ||= $default_config;
Condition66%2/3
$CONFIG{$pkg}{"template"} ||= $default_config
l!l&&r!l&&!r
2290
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
109  
110 32 ▶ return unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 2 29 31
111 30 ▶ &create_config_file(), return 1 if $_[0] eq '_CONFIG_';
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] eq "_CONFIG_" 0 29 29
112 30 ▶ goto &maker_utils if $_[0] =~ /^(install|makedist|makeppd)$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] =~ /^(install|makedist|makeppd)$/i 0 29 29
113  
114 30 my $control = shift;
115  
116 30 ▶ if (uc $control eq uc 'with') {
Branch: 4 branches
BranchTrueFalseTotal
if (uc $control eq 'WITH') { } 2 27 29
elsif (uc $control eq 'CONFIG') { } 8 19 27
elsif (exists $shortcuts{uc $control}) { } 1 18 19
elsif ($control =~ /^\S+$/ and not $control =~ /\n/) { } 18 0 18
117 3 return handle_with($pkg, @_);
118 }
119 elsif (uc $control eq uc 'Config') {
120 9 return handle_global_config($pkg, @_);
121 }
122 elsif (exists $shortcuts{uc($control)}) {
123 2 handle_shortcuts($pkg, $control, @_);
124 1 $version_requested = $CONFIG{$pkg}{template}{PRINT_VERSION};
125 1 return;
126 }
127 ▶ elsif ($control =~ /^\S+$/ and $control !~ /\n/) {
Condition33%1/3
$control =~ /^\S+$/ and not $control =~ /\n/
!ll&&!rl&&r
0018
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
128 19 my $language_id = $control;
129 19 ▶ my $option = shift || '';
Condition100%2/2
shift() || ''
l!l
153
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
130 19 my @config = @_;
131 19 my $next = 0;
132 19 for (@config) {
133 13 ▶ next if $next++ % 2;
Branch: 1 branch
BranchTrueFalseTotal
if $next++ % 2 6 6 12
134 7 ▶ croak M02_usage() if /[\s\n]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[\s\n]/ 0 6 6
135 }
136 19 $o = bless {}, $class;
137 19 $o->{INLINE}{version} = $VERSION;
138 19 $o->{API}{pkg} = $pkg;
139 19 $o->{API}{script} = $script;
140 19 $o->{API}{language_id} = $language_id;
141 19 ▶ if ($option =~ /^(FILE|BELOW)$/i or
Branch: 3 branches
BranchTrueFalseTotal
if ($option =~ /^(FILE|BELOW)$/i or not $option and defined $INC{'File::Spec::Unix'->catfile('Inline', 'Files.pm')} and Inline::Files::get_filename($pkg)) { } 0 18 18
elsif ($option eq 'DATA' or not $option) { } 5 13 18
elsif (uc $option eq 'CONFIG') { } 3 10 13
Condition44%4/9
$option =~ /^(FILE|BELOW)$/i or not $option and defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and Inline::Files::get_filename($pkg)
l!l&&r!l&&!r
0018
not $option and defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and Inline::Files::get_filename($pkg)
!ll&&!rl&&r
1800
not $option and defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")}
!ll&&!rl&&r
1530
MC/DC0%0/4
$option =~ /^(FILE|BELOW)$/i or not $option and defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and Inline::Files::get_filename($pkg)
$option =~ /^(FILE|BELOW)$/i 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)$/iB= not $optionC= defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")}D= Inline::Files::get_filename($pkg)
ABCDresult
1XXX1
01111
00XX0
010X0
01100
142 not $option and
143 defined $INC{File::Spec::Unix->catfile('Inline','Files.pm')} and
144 Inline::Files::get_filename($pkg)
145 ) {
146 1 $o->read_inline_file;
147 1 $o->{CONFIG} = handle_language_config($o->{CONFIG}, @config);
148 }
149 ▶ elsif ($option eq 'DATA' or not $option) {
Condition100%3/3
$option eq "DATA" or not $option
l!l&&r!l&&!r
2313
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
150 6 $o->{CONFIG} = handle_language_config($o->{CONFIG}, @config);
151 6 push @DATA_OBJS, $o;
152 6 return;
153 }
154 elsif (uc $option eq uc 'Config') {
155 4 $CONFIG{$pkg}{$language_id} = handle_language_config($CONFIG{$pkg}{$language_id}, @config);
156 4 return;
157 }
158 else {
159 11 $o->receive_code($option);
160 11 $o->{CONFIG} = handle_language_config($o->{CONFIG}, @config);
161 }
162 }
163 else {
164 1 croak M02_usage();
165 }
166 15 $o->glue;
167 }
168  
169 #==============================================================================
170 # Run time version of import (public method)
171 #==============================================================================
172 4 ▶sub bind {
Subroutine bind: called CC=10 SCAR=26.2
Pod documented
173 8 local ($/, $") = ("\n", ' '); local ($\, $,);
174  
175 3 my ($code, @config);
176 3 my $o;
177 3 my ($pkg, $script) = caller;
178 3 my $class = shift;
179 3 ▶ croak M03_usage_bind() unless $class eq 'Inline';
Branch: 1 branch
BranchTrueFalseTotal
unless $class eq "Inline" 0 3 3
180  
181 3 ▶ $CONFIG{$pkg}{template} ||= $default_config;
Condition33%1/3
$CONFIG{$pkg}{"template"} ||= $default_config
l!l&&r!l&&!r
300
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
182  
183 3 ▶ my $language_id = shift or croak M03_usage_bind();
Branch: 1 branch
BranchTrueFalseTotal
my $language_id = shift() or croak(M03_usage_bind()) 3 0 3
184 3 ▶ croak M03_usage_bind()
Branch: 1 branch
BranchTrueFalseTotal
unless $language_id =~ /^\S+$/ and not $language_id =~ /\n/ 0 3 3
Condition33%1/3
$language_id =~ /^\S+$/ and not $language_id =~ /\n/
!ll&&!rl&&r
003
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
185 unless ($language_id =~ /^\S+$/ and $language_id !~ /\n/);
186 3 ▶ $code = shift or croak M03_usage_bind();
Branch: 1 branch
BranchTrueFalseTotal
$code = shift() or croak(M03_usage_bind()) 3 0 3
187 3 @config = @_;
188  
189 3 my $next = 0;
190 3 for (@config) {
191 0 ▶ next if $next++ % 2;
Branch: 1 branch
BranchTrueFalseTotal
if $next++ % 2 0 0 0
192 0 ▶ croak M03_usage_bind() if /[\s\n]/;
Branch: 1 branch
BranchTrueFalseTotal
if /[\s\n]/ 0 0 0
193 }
194 3 $o = bless {}, $class;
195 3 $o->{INLINE}{version} = $VERSION;
196 3 $o->{API}{pkg} = $pkg;
197 3 $o->{API}{script} = $script;
198 3 $o->{API}{language_id} = $language_id;
199 3 $o->receive_code($code);
200 3 $o->{CONFIG} = handle_language_config($o->{CONFIG}, @config);
201  
202 3 $o->glue;
203 }
204  
205 #==============================================================================
206 # Process delayed objects that don't have source code yet.
207 #==============================================================================
208 # This code is an ugly hack because of the fact that you can't use an
209 # INIT block at "run-time proper". So we kill the warning and tell users
210 # to use an Inline->init() call if they run into problems. (rare)
211  
212 10 ▶eval <<END;
Subroutine BEGIN: called CC=1 SCAR=0.0
213 no warnings;
214 \$INIT = \$INIT; # Needed by Sarathy's patch.
215 sub INIT {
216 \$INIT++;
217 &init;
218 }
219 END
220  
221 8 ▶sub init {
Subroutine init: called CC=2 SCAR=6.9
Pod undocumented
222 7 local ($/, $") = ("\n", ' '); local ($\, $,);
223  
224 7 ▶ while (my $o = shift(@DATA_OBJS)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @DATA_OBJS) 5 7 12
225 5 $o->read_DATA;
226 5 $o->glue;
227 }
228 }
229  
230 15 ▶sub END {
Subroutine END: called CC=4 SCAR=16.9
231 15 ▶ warn M51_unused_DATA() if @DATA_OBJS;
Branch: 1 branch
BranchTrueFalseTotal
if @DATA_OBJS 0 10 10
232 15 ▶ print_version() if $version_requested && not $version_printed;
Branch: 1 branch
BranchTrueFalseTotal
if $version_requested and not $version_printed 0 10 10
Condition33%1/3
$version_requested and not $version_printed
!ll&&!rl&&r
1000
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
233 }
234  
235 #==============================================================================
236 # Print a small report about the version of Inline
237 #==============================================================================
238 1 ▶sub print_version {
Subroutine print_version: called CC=2 SCAR=17.9
Pod documented
239 0 ▶ return if $version_printed++;
Branch: 1 branch
BranchTrueFalseTotal
if $version_printed++ 0 0 0
240 0 print STDERR <<END;
241  
242 You are using Inline.pm version $VERSION
243  
244 END
245 }
246  
247 #==============================================================================
248 # Compile the source if needed and then dynaload the object
249 #==============================================================================
250 19 ▶sub glue {
Subroutine glue: called CC=23 SCAR=39.7
Pod undocumented
251 18 my $o = shift;
252 18 my ($pkg, $language_id) = @{$o->{API}}{qw(pkg language_id)};
253 18 my @config = (%{$CONFIG{$pkg}{template}},
254 18 ▶ %{$CONFIG{$pkg}{$language_id} || {}},
Condition100%2/2
$CONFIG{$pkg}{$language_id} || {}
l!l
216
MC/DC100%1/1
$CONFIG{$pkg}{$language_id} || {}
$CONFIG{$pkg}{$language_id}
Truth table100%2/2
A
A= $CONFIG{$pkg}{$language_id}
Aresult
11
00
255 18 ▶ %{$o->{CONFIG} || {}},
Condition50%1/2
$o->{'CONFIG'} || {}
l!l
180
MC/DC0%0/1
$o->{'CONFIG'} || {}
$o->{'CONFIG'}
Truth table50%1/2
A
A= $o->{'CONFIG'}
Aresult
11
00
256 );
257 18 @config = $o->check_config(@config);
258 18 $o->fold_options;
259  
260 18 $o->check_installed;
261 18 ▶ $o->env_untaint if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 18 18
262 18 ▶ if (not $o->{INLINE}{object_ready}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($o->{"INLINE"}{"object_ready"}) 18 0 18
263 18 $o->check_config_file; # Final DIRECTORY set here.
264 14 push @config, $o->with_configs;
265 14 my $language = $o->{API}{language};
266 14 ▶ croak M04_error_nocode($language_id) unless $o->{API}{code};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"API"}{"code"} 0 14 14
267 14 $o->check_module;
268 }
269 14 ▶ $o->env_untaint if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 14 14
270 14 ▶ $o->obj_untaint if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 14 14
271 14 ▶ print_version() if $version_requested;
Branch: 1 branch
BranchTrueFalseTotal
if $version_requested 0 14 14
272 14 ▶ $o->reportbug() if $o->{CONFIG}{REPORTBUG};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"REPORTBUG"} 0 14 14
273 14 ▶ if (not $o->{INLINE}{object_ready}
Branch: 1 branch
BranchTrueFalseTotal
if (not $o->{'INLINE'}{'object_ready'} or $o->{'CONFIG'}{'PRINT_INFO'}) { } 14 0 14
Condition33%1/3
not $o->{"INLINE"}{"object_ready"} or $o->{"CONFIG"}{"PRINT_INFO"}
l!l&&r!l&&!r
1400
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
274 or $o->{CONFIG}{PRINT_INFO}
275 ) {
276 14 eval "require $o->{INLINE}{ILSM_module}";
277 14 ▶ croak M05_error_eval('glue', $@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 14 14
278 14 $o->push_overrides;
279 14 bless $o, $o->{INLINE}{ILSM_module};
280 14 $o->validate(@config);
281 }
282 else {
283 0 $o->{CONFIG} = {(%{$o->{CONFIG}}, @config)};
284 }
285 13 ▶ $o->print_info if $o->{CONFIG}{PRINT_INFO};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"PRINT_INFO"} 0 13 13
286 13 ▶ unless ($o->{INLINE}{object_ready} or
Branch: 1 branch
BranchTrueFalseTotal
unless ($o->{"INLINE"}{"object_ready"} or not length $o->{"INLINE"}{"ILSM_suffix"}) 13 0 13
Condition33%1/3
$o->{"INLINE"}{"object_ready"} or not length $o->{"INLINE"}{"ILSM_suffix"}
l!l&&r!l&&!r
0013
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
287 not length $o->{INLINE}{ILSM_suffix}) {
288 13 $o->build();
289 13 ▶ $o->write_inl_file() unless $o->{CONFIG}{_INSTALL_};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"_INSTALL_"} 13 0 13
290 }
291 13 ▶ 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 13 13
Condition33%4/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
0130
$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
0013
$o->{"INLINE"}{"ILSM_suffix"} ne "so" and $o->{"INLINE"}{"ILSM_suffix"} ne "dll" and $o->{"INLINE"}{"ILSM_suffix"} ne "bundle"
!ll&&!rl&&r
0013
$o->{"INLINE"}{"ILSM_suffix"} ne "so" and $o->{"INLINE"}{"ILSM_suffix"} ne "dll"
!ll&&!rl&&r
0013
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 table16%1/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
292 $o->{INLINE}{ILSM_suffix} ne 'dll' and
293 $o->{INLINE}{ILSM_suffix} ne 'bundle' and
294 $o->{INLINE}{ILSM_suffix} ne 'sl' and
295 ref($o) eq 'Inline'
296 ) {
297 0 eval "require $o->{INLINE}{ILSM_module}";
298 0 ▶ croak M05_error_eval('glue', $@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
299 0 $o->push_overrides;
300 0 bless $o, $o->{INLINE}{ILSM_module};
301 0 $o->validate(@config);
302 }
303 13 $o->load;
304 13 $o->pop_overrides;
305 }
306  
307 #==============================================================================
308 # Set up the USING overrides
309 #==============================================================================
310 15 ▶sub push_overrides {
Subroutine push_overrides: called CC=9 SCAR=36.9
Pod undocumented
311 14 my ($o) = @_;
312 14 my ($language_id) = $o->{API}{language_id};
313 14 my ($ilsm) = $o->{INLINE}{ILSM_module};
314 14 for (@{$o->{CONFIG}{USING}}) {
315 0 ▶ my $fixed_name = /^Parser?(Pegex|RegExp|RecDescent)$/ ? "Parser::$1" : $_;
Branch: 1 branch
BranchTrueFalseTotal
/^Parser?(Pegex|RegExp|RecDescent)$/ ? : 0 0 0
316 0 $fixed_name =~ s/^:://;
317 0 ▶ my $using_module = /^::/
Branch: 2 branches
BranchTrueFalseTotal
/^::/ ? : 0 0 0
/::/ ? : 0 0 0
318 ? "Inline::${language_id}::$fixed_name"
319 : /::/
320 ? $_
321 : "Inline::${language_id}::$fixed_name";
322 0 eval "require $using_module";
323 0 ▶ croak "Invalid module '$using_module' in USING list:\n$@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
324 0 my $register;
325 0 eval "\$register = $using_module->register";
326 0 ▶ croak "Invalid module '$using_module' in USING list:\n$@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
327 0 for my $override (@{$register->{overrides}}) {
328 10 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
329 0 ▶ next if defined $o->{OVERRIDDEN}{$ilsm . "::$override"};
Branch: 1 branch
BranchTrueFalseTotal
if defined $o->{"OVERRIDDEN"}{$ilsm . "::$override"} 0 0 0
330 $o->{OVERRIDDEN}{$ilsm . "::$override"} =
331 0 \&{$ilsm . "::$override"};
332 {
333 0 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.2
334 0 *{$ilsm . "::$override"} =
335 0 \&{$using_module . "::$override"};
336 }
337 }
338 }
339 }
340  
341 #==============================================================================
342 # Restore the modules original methods
343 #==============================================================================
344 14 ▶sub pop_overrides {
Subroutine pop_overrides: called CC=2 SCAR=7.2
Pod undocumented
345 13 ▶ my $nowarn = $] >= 5.006 ? "no warnings 'redefine';" : '';
Branch: 1 branch
BranchTrueFalseTotal
$] >= 5.006 ? : 13 0 13
346 13 eval ($nowarn .
347 'my ($o) = @_;
348 for my $override (keys %{$o->{OVERRIDDEN}}) {
349 no strict "refs";
350 *{$override} = $o->{OVERRIDDEN}{$override};
351 }
352 delete $o->{OVERRIDDEN};')
353 }
354  
355 #==============================================================================
356 # Get source from the DATA filehandle
357 #==============================================================================
358 10 my (%DATA, %DATA_read);
359 6 ▶sub read_DATA {
Subroutine read_DATA: called CC=6 SCAR=18.0
Pod undocumented
360 5 require Socket;
361 5 my ($marker, $marker_tag);
362 5 my $o = shift;
363 5 my ($pkg, $language_id) = @{$o->{API}}{qw(pkg language_id)};
364 5 ▶ unless ($DATA_read{$pkg}++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($DATA_read{$pkg}++) 3 2 5
365 10 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
366 3 *Inline::DATA = *{$pkg . '::DATA'};
367 3 local ($/);
368 3 my ($CR, $LF) = (&Socket::CR, &Socket::LF);
369 3 (my $data = <Inline::DATA>) =~ s/$CR?$LF/\n/g;
370 3 @{$DATA{$pkg}} = split /(?m)^[ \t]{0,}(__\S+?__\n)/, $data;
371 3 ▶ shift @{$DATA{$pkg}} unless ($ {$DATA{$pkg}}[0] || '') =~ /__\S+?__\n/;
Branch: 1 branch
BranchTrueFalseTotal
unless (do { $DATA{$pkg} }->[0] || "") =~ /__\S+?__\n/ 3 0 3
Condition50%1/2
do { $DATA{$pkg} }->[0] || ''
l!l
30
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
372 }
373 5 ($marker, $o->{API}{code}) = splice @{$DATA{$pkg}}, 0, 2;
374 5 ▶ croak M08_no_DATA_source_code($language_id)
Branch: 1 branch
BranchTrueFalseTotal
unless defined $marker 0 5 5
375 unless defined $marker;
376 5 ($marker_tag = $marker) =~ s/__(\S+?)__\n/$1/;
377 5 ▶ croak M09_marker_mismatch($marker, $language_id)
Branch: 1 branch
BranchTrueFalseTotal
unless $marker_tag eq $language_id 0 5 5
378 unless $marker_tag eq $language_id;
379 }
380  
381 #==============================================================================
382 # Validate and store the non language-specific config options
383 #==============================================================================
384 19 ▶sub check_config {
Subroutine check_config: called CC=14 SCAR=29.1
Pod undocumented
385 18 my $o = shift;
386 18 my @others;
387 18 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 402 18 420
388 402 my ($key, $value) = (shift, shift);
389 402 ▶ if (defined $default_config->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $default_config->{$key}) { } 396 6 402
390 396 ▶ if ($key =~ /^(WITH|USING)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key =~ /^(WITH|USING)$/) 36 360 396
391 36 ▶ 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
392 if (ref $value and ref $value ne 'ARRAY');
393 36 ▶ $value = [$value] unless ref $value;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value 0 36 36
394 36 $o->{CONFIG}{$key} = $value;
395 36 next;
396 }
397 360 ▶ $o->{CONFIG}{$key} = $value, next if not $value;
Branch: 1 branch
BranchTrueFalseTotal
unless $value 271 89 360
398 89 ▶ if ($key eq 'DIRECTORY') {
Branch: 3 branches
BranchTrueFalseTotal
if ($key eq 'DIRECTORY') { } 16 73 89
elsif ($key eq 'NAME') { } 0 73 73
elsif ($key eq 'VERSION') { } 0 73 73
399 16 ▶ croak M11_usage_DIRECTORY($value) unless (-d $value);
Branch: 1 branch
BranchTrueFalseTotal
unless -d $value 0 16 16
400 16 $value = abs_path($value);
401 }
402 elsif ($key eq 'NAME') {
403 0 ▶ croak M12_usage_NAME($value)
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /^[a-zA-Z_](\w|::)*$/ 0 0 0
404 unless $value =~ /^[a-zA-Z_](\w|::)*$/;
405 }
406 elsif ($key eq 'VERSION') {
407 0 ▶ croak M13_usage_VERSION($value)
Branch: 1 branch
BranchTrueFalseTotal
unless version::is_lax($value) 0 0 0
408 unless version::is_lax($value);
409 }
410 89 $o->{CONFIG}{$key} = $value;
411 }
412 else {
413 6 push @others, $key, $value;
414 }
415 }
416 18 return (@others);
417 }
418  
419 #==============================================================================
420 # Set option defaults based on current option settings.
421 #==============================================================================
422 19 ▶sub fold_options {
Subroutine fold_options: called CC=13 SCAR=37.8
Pod undocumented
423 18 my $o = shift;
424  
425 # The following small section of code seems, to me, to be unnecessary - which is the
426 # reason that I've commented it out. I've left it here (including its associated comments)
427 # in case it later becomes evident that there *is* good reason to include it. --sisyphus
428 #
429 ## This bit tries to enable UNTAINT automatically if required when running the test suite.
430 # my $env_ha = $ENV{HARNESS_ACTIVE} || 0 ;
431 # my ($harness_active) = $env_ha =~ /(.*)/ ;
432 # if (($harness_active)&&(! $o->{CONFIG}{UNTAINT})){
433 # eval {
434 # require Scalar::Util;
435 # $o->{CONFIG}{UNTAINT} =
436 # (Scalar::Util::tainted(Cwd::cwd()) ? 1 : 0) ;
437 ## Disable SAFEMODE in the test suite, we know what we are doing...
438 # $o->{CONFIG}{SAFEMODE} = 0 ;
439 # warn "\n-[tT] enabled for test suite.
440 #Automatically setting UNTAINT=1 and SAFEMODE=0.\n"
441 # unless $Inline::_TAINT_WARNING_ ;
442 # $Inline::_TAINT_WARNING_ = 1 ;
443 # } ;
444 # }
445 ##
446 18 ▶ $untaint = $o->{CONFIG}{UNTAINT} || 0;
Condition50%1/2
$o->{'CONFIG'}{'UNTAINT'} || 0
l!l
018
MC/DC0%0/1
$o->{'CONFIG'}{'UNTAINT'} || 0
$o->{'CONFIG'}{'UNTAINT'}
Truth table50%1/2
A
A= $o->{'CONFIG'}{'UNTAINT'}
Aresult
11
00
447 $safemode = (($o->{CONFIG}{SAFEMODE} == -1) ?
448 ($untaint ? 1 : 0) :
449 $o->{CONFIG}{SAFEMODE}
450 18 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
$o->{'CONFIG'}{'SAFEMODE'} == -1 ? : 18 0 18
$untaint ? : 0 18 18
451 18 ▶ if (UNTAINT and
Branch: 1 branch
BranchTrueFalseTotal
if (UNTAINT() and SAFEMODE() and not $o->{"CONFIG"}{"DIRECTORY"}) 0 18 18
Condition33%2/6
UNTAINT() and SAFEMODE() and not $o->{"CONFIG"}{"DIRECTORY"}
!ll&&!rl&&r
1800
UNTAINT() and SAFEMODE()
!ll&&!rl&&r
1800
MC/DC0%0/3
UNTAINT() and SAFEMODE() and not $o->{"CONFIG"}{"DIRECTORY"}
UNTAINT() SAFEMODE() not $o->{"CONFIG"}{"DIRECTORY"}
Truth table25%1/4
A and B and not(C)
A= UNTAINT()B= SAFEMODE()C= not $o->{"CONFIG"}{"DIRECTORY"}
ABCresult
0XX0
10X0
1100
1111
452 SAFEMODE and
453 not $o->{CONFIG}{DIRECTORY}) {
454 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
455 0 ▶ warn M49_usage_unsafe(0) if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
456 }
457 18 ▶ if ($o->{CONFIG}{AUTONAME} == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"CONFIG"}{"AUTONAME"} == -1) 18 0 18
458 18 ▶ $o->{CONFIG}{AUTONAME} = length($o->{CONFIG}{NAME}) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
length $o->{'CONFIG'}{'NAME'} ? : 0 18 18
459 }
460 $o->{API}{cleanup} =
461 18 ▶ ($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
462 }
463  
464 #==============================================================================
465 # Check if Inline extension is preinstalled
466 #==============================================================================
467 19 ▶sub check_installed {
Subroutine check_installed: called CC=12 SCAR=43.1
Pod undocumented
468 18 my $o = shift;
469 18 $o->{INLINE}{object_ready} = 0;
470 18 ▶ 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
471 18 require Digest::MD5;
472 18 my $encoded_code = $o->{API}{code};
473 18 ▶ if ( utf8::is_utf8($encoded_code)) {
Branch: 1 branch
BranchTrueFalseTotal
if (utf8::is_utf8($encoded_code)) 1 17 18
474 1 $encoded_code = Encode::encode_utf8($encoded_code);
475 }
476 18 $o->{INLINE}{md5} = Digest::MD5::md5_hex($encoded_code);
477 }
478 else {
479 0 $o->{INLINE}{md5} = $o->{API}{code};
480 }
481 18 ▶ return if $o->{CONFIG}{_INSTALL_};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"_INSTALL_"} 0 18 18
482 18 ▶ return unless $o->{CONFIG}{VERSION};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"VERSION"} 18 0 18
483 croak M26_error_version_without_name()
484 0 ▶ unless $o->{CONFIG}{NAME};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"NAME"} 0 0 0
485  
486 0 my @pkgparts = split(/::/, $o->{API}{pkg});
487 0 my $realname = File::Spec->catfile(@pkgparts) . '.pm';
488 0 my $realname_unix = File::Spec::Unix->catfile(@pkgparts) . '.pm';
489 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
490 or croak M27_module_not_indexed($realname_unix);
491  
492 0 my ($volume,$dir,$file) = File::Spec->splitpath($realpath);
493 0 my @dirparts = File::Spec->splitdir($dir);
494 0 ▶ pop @dirparts unless $dirparts[-1];
Branch: 1 branch
BranchTrueFalseTotal
unless $dirparts[-1] 0 0 0
495 0 push @dirparts, $file;
496 0 my @endparts = splice(@dirparts, 0 - @pkgparts);
497  
498 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
499 if $dirparts[-2] eq 'blib' && $dirparts[-1] eq 'lib';
500 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
501 or croak M28_error_grokking_path($realpath);
502 0 $realpath =
503 File::Spec->catpath($volume,File::Spec->catdir(@dirparts),"");
504  
505 0 $o->{API}{version} = $o->{CONFIG}{VERSION};
506 0 $o->{API}{module} = $o->{CONFIG}{NAME};
507 0 my @modparts = split(/::/,$o->{API}{module});
508 0 $o->{API}{modfname} = $modparts[-1];
509 0 $o->{API}{modpname} = File::Spec->catdir(@modparts);
510  
511 0 my $suffix = $Config{dlext};
512 my $obj = File::Spec->catfile($realpath,'auto',$o->{API}{modpname},
513 0 "$o->{API}{modfname}.$suffix");
514 croak M30_error_no_obj($o->{CONFIG}{NAME}, $o->{API}{pkg},
515 0 ▶ $realpath) unless -f $obj;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $obj 0 0 0
516  
517 0 @{$o->{CONFIG}}{qw( PRINT_INFO
518 REPORTBUG
519 FORCE_BUILD
520 _INSTALL_
521 )} = (0, 0, 0, 0);
522  
523 0 $o->{install_lib} = $realpath;
524 0 $o->{INLINE}{ILSM_type} = 'compiled';
525 0 $o->{INLINE}{ILSM_module} = 'Inline::C';
526 0 $o->{INLINE}{ILSM_suffix} = $suffix;
527 0 $o->{INLINE}{object_ready} = 1;
528 }
529  
530 #==============================================================================
531 # Dynamically load the object module
532 #==============================================================================
533 1 ▶sub load {
Subroutine load: called CC=6 SCAR=37.4
Pod undocumented
534 0 my $o = shift;
535  
536 0 ▶ return if $o->{CONFIG}{_INSTALL_};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"_INSTALL_"} 0 0 0
537  
538 0 my ($pkg, $module) = @{$o->{API}}{qw(pkg module)};
539 0 ▶ croak M42_usage_loader() unless $o->{INLINE}{ILSM_type} eq 'compiled';
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"INLINE"}{"ILSM_type"} eq "compiled" 0 0 0
540  
541 0 require DynaLoader;
542 0 @Inline::ISA = qw(DynaLoader);
543  
544 0 ▶ my $global = $o->{CONFIG}{GLOBAL_LOAD} ? '0x01' : '0x00';
Branch: 1 branch
BranchTrueFalseTotal
$o->{'CONFIG'}{'GLOBAL_LOAD'} ? : 0 0 0
545 0 ▶ my $version = $o->{API}{version} || '0.00';
Condition0%0/2
$o->{'API'}{'version'} || '0.00'
l!l
00
MC/DC0%0/1
$o->{'API'}{'version'} || '0.00'
$o->{'API'}{'version'}
Truth table0%0/2
A
A= $o->{'API'}{'version'}
Aresult
11
00
546  
547 0 eval <<END;
548 package $pkg;
549 push \@$ {pkg}::ISA, qw($module)
550 unless \$module eq "$pkg";
551 local \$$ {module}::VERSION = '$version';
552  
553 package $module;
554 push \@$ {module}::ISA, qw(Exporter DynaLoader);
555 sub dl_load_flags { $global }
556 ${module}::->bootstrap;
557 END
558 0 ▶ croak M43_error_bootstrap($module, $@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
559 }
560  
561 #==============================================================================
562 # Create file that satisfies the Makefile dependency for this object
563 #==============================================================================
564  
565 5 ▶sub satisfy_makefile_dep {
Subroutine satisfy_makefile_dep: called CC=2 SCAR=17.9
Pod undocumented
566 0 my $o = shift;
567  
568 0 my $inline = $o->{API}{modinlname};
569 0 ▶ open my $fh, ">", $inline
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $inline or croak(M24_open_for_output_failed($inline)) 0 0 0
570 or croak M24_open_for_output_failed($inline);
571 0 print $fh "*** AUTOGENERATED by Inline.pm ***\n\n";
572 0 print $fh "This file satisfies the make dependency for ";
573 0 print $fh "$o->{API}{module}\n";
574 0 close $fh;
575 0 return;
576 }
577  
578 #==============================================================================
579 # Process the config options that apply to all Inline sections
580 #==============================================================================
581 8 ▶sub handle_global_config {
Subroutine handle_global_config: called CC=6 SCAR=18.2
Pod undocumented
582 8 my $pkg = shift;
583 8 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 13 8 21
584 13 my ($key, $value) = (uc shift, shift);
585 13 ▶ croak M02_usage() if $key =~ /[\s\n]/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /[\s\n]/ 0 13 13
586 13 ▶ if ($key =~ /^(ENABLE|DISABLE)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key =~ /^(ENABLE|DISABLE)$/) 2 11 13
587 2 ▶ ($key, $value) = (uc $value, $key eq 'ENABLE' ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$key eq 'ENABLE' ? : 0 2 2
588 }
589 croak M47_invalid_config_option($key)
590 13 ▶ unless defined $default_config->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $default_config->{$key} 0 13 13
591 13 $CONFIG{$pkg}{template}{$key} = $value;
592 }
593 }
594  
595 #==============================================================================
596 # Process the config options that apply to a particular language
597 #==============================================================================
598 21 ▶sub handle_language_config {
Subroutine handle_language_config: called CC=6 SCAR=18.1
Pod undocumented
599 21 ▶ my %merge_with = %{ shift || {} };
Condition100%2/2
shift() || {}
l!l
120
MC/DC100%1/1
shift() || {}
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
600 21 my @values;
601 21 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 6 21 27
602 6 my ($key, $value) = (uc shift, shift);
603 6 ▶ croak M02_usage() if $key =~ /[\s\n]/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /[\s\n]/ 0 6 6
604 6 ▶ if ($key eq 'ENABLE') {
Branch: 2 branches
BranchTrueFalseTotal
if ($key eq 'ENABLE') { } 4 2 6
elsif ($key eq 'DISABLE') { } 0 2 2
605 4 push @values, uc $value, 1;
606 }
607 elsif ($key eq 'DISABLE') {
608 0 push @values, uc $value, 0;
609 }
610 else {
611 2 push @values, $key, $value;
612 }
613 }
614 21 return {%merge_with, @values};
615 }
616  
617 #==============================================================================
618 # Validate and store shortcut config options
619 #==============================================================================
620 1 ▶sub handle_shortcuts {
Subroutine handle_shortcuts: called CC=4 SCAR=14.0
Pod undocumented
621 1 my $pkg = shift;
622  
623 1 for my $option (@_) {
624 2 my $OPTION = uc($option);
625 2 ▶ if ($OPTION eq 'SITE_INSTALL') {
Branch: 2 branches
BranchTrueFalseTotal
if ($OPTION eq 'SITE_INSTALL') { } 0 2 2
elsif ($shortcuts{$OPTION}) { } 1 1 2
626 0 croak M58_site_install();
627 }
628 elsif ($shortcuts{$OPTION}) {
629 1 my ($method, $arg) = @{$shortcuts{$OPTION}};
630 1 $CONFIG{$pkg}{template}{$method} = $arg;
631 }
632 else {
633 1 croak M48_usage_shortcuts($option);
634 }
635 }
636 }
637  
638 #==============================================================================
639 # Process the with command
640 #==============================================================================
641 2 ▶sub handle_with {
Subroutine handle_with: called CC=5 SCAR=16.6
Pod undocumented
642 2 my $pkg = shift;
643 2 ▶ croak M45_usage_with() unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 2 2
644 2 for (@_) {
645 2 ▶ croak M02_usage() unless /^[\w:]+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless /^[\w:]+$/ 0 2 2
646 2 eval "require $_;";
647 2 ▶ croak M46_usage_with_bad($_) . $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 2 2
648 2 push @{$CONFIG{$pkg}{template}{WITH}}, $_;
649 }
650 }
651  
652 #==============================================================================
653 # Perform cleanup duties
654 #==============================================================================
655 21 ▶sub DESTROY {
Subroutine DESTROY: called CC=2 SCAR=7.2
656 21 my $o = shift;
657 21 ▶ $o->clean_build if $o->{CONFIG}{CLEAN_BUILD_AREA};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"CLEAN_BUILD_AREA"} 0 21 21
658 }
659  
660 #==============================================================================
661 # Get the source code
662 #==============================================================================
663 13 ▶sub receive_code {
Subroutine receive_code: called CC=9 SCAR=25.4
Pod undocumented
664 13 my $o = shift;
665 13 my $code = shift;
666  
667 13 ▶ croak M02_usage() unless (defined $code and $code);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $code and $code 0 13 13
Condition33%1/3
defined $code and $code
!ll&&!rl&&r
0013
MC/DC0%0/2
defined $code and $code
defined $code $code
Truth table33%1/3
A and B
A= defined $codeB= $code
ABresult
0X0
100
111
668  
669 13 ▶ if (ref $code eq 'CODE') {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $code eq 'CODE') { } 0 13 13
elsif (ref $code eq 'ARRAY') { } 0 13 13
elsif ($code =~ m[[/\\:]] and $code =~ m(^[/\\:\w.\-\ \$\[\]<>]+$)) { } 1 12 13
670 0 $o->{API}{code} = &$code;
671 }
672 elsif (ref $code eq 'ARRAY') {
673 0 $o->{API}{code} = join '', @$code;
674 }
675 ▶ elsif ($code =~ m|[/\\:]| and
Condition66%2/3
$code =~ m[[/\\:]] and $code =~ m(^[/\\:\w.\-\ \$\[\]<>]+$)
!ll&&!rl&&r
1201
MC/DC50%1/2
$code =~ m[[/\\:]] and $code =~ m(^[/\\:\w.\-\ \$\[\]<>]+$)
$code =~ m[[/\\:]] $code =~ m(^[/\\:\w.\-\ \$\[\]<>]+$)
Truth table66%2/3
A and B
A= $code =~ m[[/\\:]]B= $code =~ m(^[/\\:\w.\-\ \$\[\]<>]+$)
ABresult
0X0
100
111
676 $code =~ m|^[/\\:\w.\-\ \$\[\]<>]+$|) {
677 open my $fh, "<", $code
678 or croak(
679 6 ▶ $!{ENOENT}
Subroutine BEGIN: called CC=1 SCAR=0.0
680 1 ▶ ? M07_code_file_does_not_exist($code)
Branch: 2 branches
BranchTrueFalseTotal
open my $fh, "<", $code or croak($!{"ENOENT"} ? M07_code_file_does_not_exist($code) : M06_code_file_failed_open($code)) 1 0 1
$!{'ENOENT'} ? : 0 0 0
681 : M06_code_file_failed_open($code)
682 );
683 1 local $/;
684 1 $o->{API}{code} = readline $fh;
685 }
686 else {
687 12 $o->{API}{code} = $code;
688 }
689 }
690  
691 #==============================================================================
692 # Get the source code from an Inline::Files filehandle
693 #==============================================================================
694 0 ▶sub read_inline_file {
Subroutine read_inline_file: not called CC=6 SCAR=34.4
Pod undocumented
695 0 my $o = shift;
696 0 my ($lang, $pkg) = @{$o->{API}}{qw(language_id pkg)};
697 0 my $langfile = uc($lang);
698 0 ▶ croak M59_bad_inline_file($lang) unless $langfile =~ /^[A-Z]\w*$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $langfile =~ /^[A-Z]\w*$/ 0 0 0
699 croak M60_no_inline_files()
700 0 ▶ unless (defined $INC{File::Spec::Unix->catfile("Inline","Files.pm")} and
Branch: 1 branch
BranchTrueFalseTotal
unless defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and $Inline::Files::VERSION =~ /^\d\.\d\d$/ and $Inline::Files::VERSION ge "0.51" 0 0 0
Condition0%0/6
defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and $Inline::Files::VERSION =~ /^\d\.\d\d$/ and $Inline::Files::VERSION ge "0.51"
!ll&&!rl&&r
000
defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and $Inline::Files::VERSION =~ /^\d\.\d\d$/
!ll&&!rl&&r
000
MC/DC0%0/3
defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} and $Inline::Files::VERSION =~ /^\d\.\d\d$/ and $Inline::Files::VERSION ge "0.51"
defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")} $Inline::Files::VERSION =~ /^\d\.\d\d$/ $Inline::Files::VERSION ge "0.51"
Truth table0%0/4
A and B and C
A= defined $INC{"File::Spec::Unix"->catfile("Inline", "Files.pm")}B= $Inline::Files::VERSION =~ /^\d\.\d\d$/C= $Inline::Files::VERSION ge "0.51"
ABCresult
0XX0
10X0
1100
1111
701 $Inline::Files::VERSION =~ /^\d\.\d\d$/ and
702 $Inline::Files::VERSION ge '0.51');
703 0 ▶ croak M61_not_parsed() unless $lang = Inline::Files::get_filename($pkg);
Branch: 1 branch
BranchTrueFalseTotal
unless $lang = Inline::Files::get_filename($pkg) 0 0 0
704 {
705 0 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
706 0 local $/;
707 0 $Inline::FILE = \*{"${pkg}::$langfile"};
708 # open $Inline::FILE;
709 0 $o->{API}{code} = <$Inline::FILE>;
710 # close $Inline::FILE;
711 }
712 }
713  
714 #==============================================================================
715 # Read the cached config file from the Inline directory. This will indicate
716 # whether the Language code is valid or not.
717 #==============================================================================
718 18 ▶sub check_config_file {
Subroutine check_config_file: called CC=20 SCAR=35.6
Pod undocumented
719 18 my ($DIRECTORY, %config);
720 18 my $o = shift;
721  
722 18 ▶ croak M14_usage_Config() if $Inline::Config::VERSION;
Branch: 1 branch
BranchTrueFalseTotal
if $Inline::Config::VERSION 0 18 18
723 croak M63_no_source($o->{API}{pkg})
724 18 ▶ if $o->{INLINE}{md5} eq $o->{API}{code};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"INLINE"}{"md5"} eq $o->{"API"}{"code"} 0 18 18
725  
726 # First make sure we have the DIRECTORY
727 18 ▶ if ($o->{CONFIG}{_INSTALL_}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{'CONFIG'}{'_INSTALL_'}) { } 0 18 18
728 croak M15_usage_install_directory()
729 0 ▶ if $o->{CONFIG}{DIRECTORY};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"DIRECTORY"} 0 0 0
730 0 my $cwd = Cwd::cwd();
731 $DIRECTORY =
732 0 $o->{INLINE}{DIRECTORY} = File::Spec->catdir($cwd, $did);
733 0 ▶ _mkdir($DIRECTORY, 0777)
Branch: 1 branch
BranchTrueFalseTotal
_mkdir($DIRECTORY, 511) or croak(M16_DIRECTORY_mkdir_failed($DIRECTORY)) 0 0 0
734 or croak M16_DIRECTORY_mkdir_failed($DIRECTORY);
735 }
736 else {
737 $DIRECTORY = $o->{INLINE}{DIRECTORY} =
738 18 ▶ $o->{CONFIG}{DIRECTORY} || $o->find_temp_dir;
Condition66%2/3
$o->{'CONFIG'}{'DIRECTORY'} || $o->find_temp_dir
l!l&&r!l&&!r
1620
MC/DC0%0/2
$o->{'CONFIG'}{'DIRECTORY'} || $o->find_temp_dir
$o->{'CONFIG'}{'DIRECTORY'} $o->find_temp_dir
Truth table66%2/3
A || B
A= $o->{'CONFIG'}{'DIRECTORY'}B= $o->find_temp_dir
ABresult
1X1
011
000
739 }
740  
741 18 ▶ if($o->{CONFIG}{REWRITE_CONFIG_FILE}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"CONFIG"}{"REWRITE_CONFIG_FILE"}) 1 17 18
742 1 ▶ if(-e File::Spec->catfile($DIRECTORY, $configuration_file)) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e "File::Spec"->catfile($DIRECTORY, $Inline::configuration_file)) 1 0 1
743 1 my $unlink = unlink(File::Spec->catfile($DIRECTORY, $configuration_file));
744 0 ▶ if(!$unlink) {warn "REWRITE_CONFIG_FILE is set, but removal of config file failed"}
Branch: 1 branch
BranchTrueFalseTotal
if (not $unlink) { } 0 1 1
745 1 ▶ else {warn "config file removal successful\n" if $o->{CONFIG}{_TESTING}}
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"_TESTING"} 1 0 1
746 }
747 }
748  
749 22 ▶ my $load_cfg = sub {
Subroutine __ANON__: called CC=6 SCAR=20.7
750 22 ▶ $o->create_config_file($DIRECTORY)
Branch: 1 branch
BranchTrueFalseTotal
unless -s "File::Spec"->catfile($DIRECTORY, $Inline::configuration_file) 12 10 22
751 if not -s File::Spec->catfile($DIRECTORY, $configuration_file);
752  
753 22 ▶ open my $fh, "<", File::Spec->catfile($DIRECTORY,$configuration_file)
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", "File::Spec"->catfile($DIRECTORY, $Inline::configuration_file) or croak(M17_config_open_failed($DIRECTORY)) 22 0 22
754 or croak M17_config_open_failed($DIRECTORY);
755 22 flock($fh, LOCK_SH) if CAN_FLOCK;
756 22 my $config = do { local $/; readline $fh };
757 22 close $fh;
758  
759 22 ▶ unless($config =~ /^version :/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($config =~ /^version :/) 0 22 22
760 0 warn "\$load_cfg sub: \$config: *${config}*\n";
761 0 croak M62_invalid_config_file(File::Spec->catfile($DIRECTORY,$configuration_file));
762 }
763  
764 22 ▶ if(UNTAINT) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNTAINT()) 0 22 22
765 warn "In Inline::check_config_file(): Blindly untainting Inline configuration file information.\n"
766 0 ▶ unless $o->{CONFIG}{NO_UNTAINT_WARN};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"NO_UNTAINT_WARN"} 0 0 0
767 0 ($config) = $config =~ /(.*)/s;
768 }
769  
770 22 %config = Inline::denter->new()->undent($config);
771 18 } ;
772  
773 18 $load_cfg->() ;
774 18 ▶ if (! defined $config{languages}->{$o->{API}{language_id}}){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $config{"languages"}{$o->{"API"}{"language_id"}}) 4 14 18
775 4 my $unlink = unlink(File::Spec->catfile($DIRECTORY, $configuration_file));
776 0 ▶ if(!$unlink) {warn "Failed to remove config file"}
Branch: 1 branch
BranchTrueFalseTotal
if (not $unlink) { } 0 4 4
777 4 ▶ else {warn "config file removed\n" if $o->{CONFIG}{_TESTING}}
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"_TESTING"} 1 3 4
778 4 $load_cfg->() ;
779 }
780  
781 18 $Inline::languages = $config{languages};
782  
783 {
784 10 ▶ no warnings ('numeric'); # These warnings were a pain with devel releases.
Subroutine BEGIN: called CC=1 SCAR=0.0
785 # If there's a problem with the version number, the
786 # error message will output $config{version} anyway.
787 croak M18_error_old_version($config{version}, $DIRECTORY)
788 unless (defined $config{version} and
789 $config{version} =~ /TRIAL/ or
790 18 ▶ $config{version} >= 0.40);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $config{"version"} and $config{"version"} =~ /TRIAL/ or $config{"version"} >= "0.4" 0 18 18
Condition33%2/6
defined $config{"version"} and $config{"version"} =~ /TRIAL/ or $config{"version"} >= "0.4"
l!l&&r!l&&!r
0180
defined $config{"version"} and $config{"version"} =~ /TRIAL/
!ll&&!rl&&r
0180
MC/DC0%0/3
defined $config{"version"} and $config{"version"} =~ /TRIAL/ or $config{"version"} >= "0.4"
defined $config{"version"} $config{"version"} =~ /TRIAL/ $config{"version"} >= "0.4"
Truth table20%1/5
A and B or C
A= defined $config{"version"}B= $config{"version"} =~ /TRIAL/C= $config{"version"} >= "0.4"
ABCresult
11X1
0X11
1011
0X00
1000
791 } # numeric warnings re-enabled.
792  
793 croak M19_usage_language($o->{API}{language_id}, $DIRECTORY)
794 18 ▶ unless defined $config{languages}->{$o->{API}{language_id}};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $config{"languages"}{$o->{"API"}{"language_id"}} 4 14 18
795 14 $o->{API}{language} = $config{languages}->{$o->{API}{language_id}};
796 14 ▶ if ($o->{API}{language} ne $o->{API}{language_id}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"API"}{"language"} ne $o->{"API"}{"language_id"}) 1 13 14
797 1 ▶ if (defined $o->{$o->{API}{language_id}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $$o{$o->{"API"}{"language_id"}}) 0 1 1
798 0 $o->{$o->{API}{language}} = $o->{$o->{API}{language_id}};
799 0 delete $o->{$o->{API}{language_id}};
800 }
801 }
802  
803 14 $o->{INLINE}{ILSM_type} = $config{types}->{$o->{API}{language}};
804 14 $o->{INLINE}{ILSM_module} = $config{modules}->{$o->{API}{language}};
805 14 $o->{INLINE}{ILSM_suffix} = $config{suffixes}->{$o->{API}{language}};
806 }
807  
808 15 ▶sub derive_minus_I {
Subroutine derive_minus_I: called CC=4 SCAR=14.7
Pod undocumented
809 15 my $o = shift;
810 15 require Cwd;
811 my @libexclude = (
812 # perl has these already
813 (grep length, map $Config{$_},
814 qw(archlibexp privlibexp sitearchexp sitelibexp vendorarchexp vendorlibexp)),
815 (defined $ENV{PERL5LIB} ? (
816 15 map { my $l = $_; ($l, map File::Spec->catdir($l, $Config{$_}), qw(version archname)) }
817 split $Config{path_sep}, $ENV{PERL5LIB}
818 15 ▶ ) : ()),
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5LIB'} ? : 15 0 15
819 );
820 15 ▶ if ($^O eq 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32") 0 15 15
821 # Strawberry Perl Unix-ises its @INC, so we need to add Unix-y versions
822 push @libexclude,
823 0 map { my $d = $_; $d =~ s#\\#/#g; $d }
824 @libexclude;
825 }
826 15 my %libexclude = map { $_=>1 } @libexclude;
827 15 my @libinclude = grep !$libexclude{$_}, grep { $_ ne '.' } @INC;
828 # grep is because on Windows, Cwd::abs_path blows up on non-exist dir
829 15 @libinclude = map Cwd::abs_path($_), grep -e, @libinclude;
830 15 my %seen; @libinclude = grep !$seen{$_}++, @libinclude; # de-dup
831 15 ▶ @libinclude = map /(.*)/s, @libinclude if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 15 15
832 15 @libinclude;
833 }
834  
835 #==============================================================================
836 # Auto-detect installed Inline language support modules
837 #==============================================================================
838 12 ▶sub create_config_file {
Subroutine create_config_file: called CC=21 SCAR=55.1
Pod undocumented
839 12 my ($o, $dir) = @_;
840  
841 # This subroutine actually fires off another instance of perl.
842 # with arguments that make this routine get called again.
843 # That way the queried modules don't stay loaded.
844 12 ▶ if (defined $o) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $o) 12 0 12
845 12 ▶ ($dir) = $dir =~ /(.*)/s if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 12 12
846 12 my $perl = $Config{perlpath};
847 12 ▶ $perl = $^X unless -f $perl;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $perl 0 12 12
848 12 ▶ ($perl) = $perl =~ /(.*)/s if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 12 12
849 12 ▶ local $ENV{PERL5OPT} if defined $ENV{PERL5OPT};
Branch: 1 branch
BranchTrueFalseTotal
if defined $ENV{"PERL5OPT"} 12 0 12
850  
851 12 my @_inc = map "-I$_", $o->derive_minus_I;
852 12 ▶ system $perl, @_inc, "-MInline=_CONFIG_", "-e1", "$dir"
Branch: 1 branch
BranchTrueFalseTotal
system $perl, @_inc, "-MInline=_CONFIG_", "-e1", "$dir" and croak(M20_config_creation_failed($dir)) 0 12 12
853 and croak M20_config_creation_failed($dir);
854 12 return;
855 }
856  
857 0 my ($lib, $mod, $register, %checked,
858 %languages, %types, %modules, %suffixes);
859 0 for my $lib (@INC) {
860 0 ▶ next unless -d File::Spec->catdir($lib,"Inline");
Branch: 1 branch
BranchTrueFalseTotal
unless -d "File::Spec"->catdir($lib, "Inline") 0 0 0
861 0 ▶ opendir my $dh, File::Spec->catdir($lib,"Inline")
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dh, "File::Spec"->catdir($lib, "Inline") or warn(M21_opendir_failed("File::Spec"->catdir($lib, "Inline"))), next 0 0 0
862 or warn(M21_opendir_failed(File::Spec->catdir($lib,"Inline"))), next;
863 0 ▶ while ($mod = readdir($dh)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($mod = readdir $dh)) 0 0 0
864 0 ▶ next unless $mod =~ /\.pm$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $mod =~ /\.pm$/ 0 0 0
865 0 $mod =~ s/\.pm$//;
866 0 ▶ next if ($checked{$mod}++);
Branch: 1 branch
BranchTrueFalseTotal
if $checked{$mod}++ 0 0 0
867 0 ▶ if ($mod eq 'Config') { # Skip Inline::Config
Branch: 1 branch
BranchTrueFalseTotal
if ($mod eq "Config") 0 0 0
868 0 warn M14_usage_Config();
869 0 next;
870 }
871 0 ▶ next if $mod =~ /^(MakeMaker|denter|messages)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $mod =~ /^(MakeMaker|denter|messages)$/ 0 0 0
872 # @INC is made safe by -T disallowing PERL5LIB et al
873 0 ($mod) = $mod =~ /(.*)/;
874 0 eval "require Inline::$mod;";
875 0 ▶ warn($@), next if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
876 0 eval "\$register=&Inline::${mod}::register";
877 0 ▶ next if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
878 my $language = ($register->{language})
879 0 ▶ or warn(M22_usage_register($mod)), next;
Branch: 1 branch
BranchTrueFalseTotal
my $language = $register->{"language"} or warn(M22_usage_register($mod)), next 0 0 0
880 0 for (@{$register->{aliases}}) {
881 warn(M23_usage_alias_used($mod, $_, $languages{$_})), next
882 0 ▶ if defined $languages{$_};
Branch: 1 branch
BranchTrueFalseTotal
if defined $languages{$_} 0 0 0
883 0 $languages{$_} = $language;
884 }
885 0 $languages{$language} = $language;
886 0 $types{$language} = $register->{type};
887 0 $modules{$language} = "Inline::$mod";
888 0 $suffixes{$language} = $register->{suffix};
889 }
890 0 closedir $dh;
891 }
892  
893 0 my $file = File::Spec->catfile($ARGV[0], $configuration_file);
894 0 ▶ sysopen my $fh, $file, O_WRONLY | O_CREAT, 0666
Branch: 1 branch
BranchTrueFalseTotal
sysopen my $fh, $file, 65, 438 or croak(M24_open_for_output_failed($file)) 0 0 0
895 or croak M24_open_for_output_failed($file);
896 0 flock($fh, LOCK_EX) if CAN_FLOCK;
897 0 truncate($fh, 0);
898 0 print $fh Inline::denter->new()
899 ->indent(*version => $Inline::VERSION,
900 *languages => \%languages,
901 *types => \%types,
902 *modules => \%modules,
903 *suffixes => \%suffixes,
904 );
905 0 close $fh;
906 0 exit 0;
907 }
908  
909 #==============================================================================
910 # Check to see if code has already been compiled
911 #==============================================================================
912 14 ▶sub check_module {
Subroutine check_module: called CC=17 SCAR=40.0
Pod undocumented
913 14 my ($module, $module2);
914 14 my $o = shift;
915 14 ▶ return $o->install if $o->{CONFIG}{_INSTALL_};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"_INSTALL_"} 0 14 14
916  
917 14 ▶ if ($o->{CONFIG}{NAME}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($o->{'CONFIG'}{'NAME'}) { } 0 14 14
elsif ($o->{'API'}{'pkg'} eq 'main') { } 13 1 14
918 0 $module = $o->{CONFIG}{NAME};
919 }
920 elsif ($o->{API}{pkg} eq 'main') {
921 13 $module = $o->{API}{script};
922 13 my($v,$d,$file) = File::Spec->splitpath($module);
923 13 $module = $file;
924 13 $module =~ s|\W|_|g;
925 13 $module =~ s|^_+||;
926 13 $module =~ s|_+$||;
927 13 ▶ $module = 'FOO' if $module =~ /^_*$/;
Branch: 1 branch
BranchTrueFalseTotal
if $module =~ /^_*$/ 0 13 13
928 13 ▶ $module = "_$module" if $module =~ /^\d/;
Branch: 1 branch
BranchTrueFalseTotal
if $module =~ /^\d/ 13 0 13
929 }
930 else {
931 1 $module = $o->{API}{pkg};
932 }
933  
934 14 $o->{API}{suffix} = $o->{INLINE}{ILSM_suffix};
935 14 $o->{API}{directory} = $o->{INLINE}{DIRECTORY};
936  
937 14 my $auto_level = 2;
938 14 ▶ while ($auto_level <= 5) {
Branch: 1 branch
BranchTrueFalseTotal
if ($auto_level <= 5) 14 0 14
939 14 ▶ if ($o->{CONFIG}{AUTONAME}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{'CONFIG'}{'AUTONAME'}) { } 14 0 14
940 $module2 =
941 14 $module . '_' . substr($o->{INLINE}{md5}, 0, 2 + $auto_level);
942 14 $auto_level++;
943 } else {
944 0 $module2 = $module;
945 0 $auto_level = 6; # Don't loop on non-autoname objects
946 }
947 14 $o->{API}{module} = $module2;
948 14 my @modparts = split /::/, $module2;
949 14 $o->{API}{modfname} = $modparts[-1];
950 14 $o->{API}{modpname} = File::Spec->catdir(@modparts);
951 $o->{API}{build_dir} =
952 File::Spec->catdir($o->{INLINE}{DIRECTORY},
953 14 'build',$o->{API}{modpname});
954 $o->{API}{install_lib} =
955 14 File::Spec->catdir($o->{INLINE}{DIRECTORY}, 'lib');
956  
957 my $inl = File::Spec->catfile($o->{API}{install_lib},"auto",
958 14 $o->{API}{modpname},"$o->{API}{modfname}.inl");
959 $o->{API}{location} =
960 File::Spec->catfile($o->{API}{install_lib},"auto",$o->{API}{modpname},
961 14 "$o->{API}{modfname}.$o->{INLINE}{ILSM_suffix}");
962 14 ▶ last unless -f $inl;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $inl 14 0 14
963 0 my %inl;
964 {
965 0 ▶ open my $fh, "<", $inl or croak M31_inline_open_failed($inl);
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $inl or croak(M31_inline_open_failed($inl)) 0 0 0
966 0 local $/;
967 0 %inl = Inline::denter->new()->undent(readline $fh);
968 }
969 0 ▶ next unless ($o->{INLINE}{md5} eq $inl{md5});
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"INLINE"}{"md5"} eq $inl{"md5"} 0 0 0
970 0 ▶ next unless ($inl{inline_version} ge '0.40');
Branch: 1 branch
BranchTrueFalseTotal
unless $inl{"inline_version"} ge "0.40" 0 0 0
971 0 ▶ next unless ($inl{Config}{version} eq $Config::Config{version});
Branch: 1 branch
BranchTrueFalseTotal
unless $inl{"Config"}{"version"} eq $Config::Config{"version"} 0 0 0
972 0 ▶ next unless ($inl{Config}{archname} eq $Config::Config{archname});
Branch: 1 branch
BranchTrueFalseTotal
unless $inl{"Config"}{"archname"} eq $Config::Config{"archname"} 0 0 0
973 0 ▶ unless (-f $o->{API}{location}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $o->{"API"}{"location"}) 0 0 0
974 0 ▶ warn <<END if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
975 Missing object file: $o->{API}{location}
976 For Inline file: $inl
977 END
978 0 next;
979 }
980 0 ▶ $o->{INLINE}{object_ready} = 1 unless $o->{CONFIG}{FORCE_BUILD};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"FORCE_BUILD"} 0 0 0
981 0 last;
982 }
983 14 unshift @::INC, $o->{API}{install_lib};
984 }
985  
986 #==============================================================================
987 # Set things up so that the extension gets installed into the blib/arch.
988 # Then 'make install' will do the right thing.
989 #==============================================================================
990 0 ▶sub install {
Subroutine install: not called CC=8 SCAR=42.8
Pod undocumented
991 0 my ($module, $DIRECTORY);
992 0 my $o = shift;
993  
994 croak M64_install_not_c($o->{API}{language_id})
995 0 ▶ unless uc($o->{API}{language_id}) =~ /^(C|CPP|Java|Python|Ruby|Lisp|Pdlpp)$/ ;
Branch: 1 branch
BranchTrueFalseTotal
unless uc($o->{"API"}{"language_id"}) =~ /^(C|CPP|Java|Python|Ruby|Lisp|Pdlpp)$/ 0 0 0
996 croak M36_usage_install_main()
997 0 ▶ if ($o->{API}{pkg} eq 'main');
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"API"}{"pkg"} eq "main" 0 0 0
998 croak M37_usage_install_auto()
999 0 ▶ if $o->{CONFIG}{AUTONAME};
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"CONFIG"}{"AUTONAME"} 0 0 0
1000 croak M38_usage_install_name()
1001 0 ▶ unless $o->{CONFIG}{NAME};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"NAME"} 0 0 0
1002 croak M39_usage_install_version()
1003 0 ▶ unless $o->{CONFIG}{VERSION};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"VERSION"} 0 0 0
1004 croak M40_usage_install_badname($o->{CONFIG}{NAME}, $o->{API}{pkg})
1005 0 ▶ unless $o->{CONFIG}{NAME} eq $o->{API}{pkg};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"NAME"} eq $o->{"API"}{"pkg"} 0 0 0
1006 # $o->{CONFIG}{NAME} =~ /^$o->{API}{pkg}::\w(\w|::)+$/
1007 # );
1008  
1009 my ($mod_name, $mod_ver, $ext_name, $ext_ver) =
1010 0 ($o->{API}{pkg}, $ARGV[0], @{$o->{CONFIG}}{qw(NAME VERSION)});
1011 0 ▶ croak M41_usage_install_version_mismatch($mod_name, $mod_ver,
Branch: 1 branch
BranchTrueFalseTotal
unless $mod_ver eq $ext_ver 0 0 0
1012 $ext_name, $ext_ver)
1013 unless ($mod_ver eq $ext_ver);
1014 0 $o->{INLINE}{INST_ARCHLIB} = $ARGV[1];
1015  
1016 0 $o->{API}{version} = $o->{CONFIG}{VERSION};
1017 0 $o->{API}{module} = $o->{CONFIG}{NAME};
1018 0 my @modparts = split(/::/,$o->{API}{module});
1019 0 $o->{API}{modfname} = $modparts[-1];
1020 0 $o->{API}{modpname} = File::Spec->catdir(@modparts);
1021 0 $o->{API}{modinlname} = join('-',@modparts).'.inl';
1022 0 $o->{API}{suffix} = $o->{INLINE}{ILSM_suffix};
1023 $o->{API}{build_dir} = File::Spec->catdir($o->{INLINE}{DIRECTORY},'build',
1024 0 $o->{API}{modpname});
1025 0 $o->{API}{directory} = $o->{INLINE}{DIRECTORY};
1026 0 my $cwd = Cwd::cwd();
1027 $o->{API}{install_lib} =
1028 0 File::Spec->catdir($cwd,$o->{INLINE}{INST_ARCHLIB});
1029 $o->{API}{location} =
1030 File::Spec->catfile($o->{API}{install_lib},"auto",$o->{API}{modpname},
1031 0 "$o->{API}{modfname}.$o->{INLINE}{ILSM_suffix}");
1032 0 unshift @::INC, $o->{API}{install_lib};
1033 0 $o->{INLINE}{object_ready} = 0;
1034 }
1035  
1036 #==============================================================================
1037 # Create the .inl file for an object
1038 #==============================================================================
1039 13 ▶sub write_inl_file {
Subroutine write_inl_file: called CC=3 SCAR=11.3
Pod undocumented
1040 13 my $o = shift;
1041 my $inl =
1042 File::Spec->catfile($o->{API}{install_lib},"auto",$o->{API}{modpname},
1043 13 "$o->{API}{modfname}.inl");
1044 13 ▶ open my $fh, ">", $inl
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $inl or croak("Can't create Inline validation file ${inl}: $!") 13 0 13
1045 or croak "Can't create Inline validation file $inl: $!";
1046 13 ▶ my $apiversion = $Config{apiversion} || $Config{xs_apiversion};
Condition33%1/3
$Inline::Config{'apiversion'} || $Inline::Config{'xs_apiversion'}
l!l&&r!l&&!r
0013
MC/DC0%0/2
$Inline::Config{'apiversion'} || $Inline::Config{'xs_apiversion'}
$Inline::Config{'apiversion'} $Inline::Config{'xs_apiversion'}
Truth table33%1/3
A || B
A= $Inline::Config{'apiversion'}B= $Inline::Config{'xs_apiversion'}
ABresult
1X1
011
000
1047 print $fh Inline::denter->new()
1048 ->indent(*md5, $o->{INLINE}{md5},
1049 *name, $o->{API}{module},
1050 *version, $o->{CONFIG}{VERSION},
1051 *language, $o->{API}{language},
1052 *language_id, $o->{API}{language_id},
1053 *installed, $o->{CONFIG}{_INSTALL_},
1054 *date_compiled, scalar localtime,
1055 *inline_version, $Inline::VERSION,
1056 39 *ILSM, { map {($_, $o->{INLINE}{"ILSM_$_"})}
1057 (qw( module suffix type ))
1058 },
1059 13 *Config, { (map {($_,$Config{$_})}
1060 (qw( archname osname osvers
1061 cc ccflags ld so version
1062 ))),
1063 (apiversion => $apiversion),
1064 },
1065 );
1066 13 close $fh;
1067 }
1068  
1069 #==============================================================================
1070 # Get config hints
1071 #==============================================================================
1072 14 ▶sub with_configs {
Subroutine with_configs: called CC=4 SCAR=14.0
Pod undocumented
1073 14 my $o = shift;
1074 14 my @configs;
1075 14 for my $mod (@{$o->{CONFIG}{WITH}}) {
1076 1 my $ref = eval { $mod->Inline($o->{API}{language}); };
1077 1 ▶ croak M25_no_WITH_support($mod, $@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
1078 1 ▶ croak M65_WITH_not_lang($mod, $o->{API}{language}) unless $ref;
Branch: 1 branch
BranchTrueFalseTotal
unless $ref 0 1 1
1079 1 push @configs, %$ref;
1080 }
1081 14 return @configs;
1082 }
1083  
1084 #==============================================================================
1085 # Blindly untaint tainted fields in %ENV.
1086 #==============================================================================
1087 0 ▶sub env_untaint {
Subroutine env_untaint: not called CC=11 SCAR=46.6
Pod undocumented
1088 0 my $o = shift;
1089 0 ▶ warn "In Inline::env_untaint() : Blindly untainting tainted fields in %ENV.\n" unless $o->{CONFIG}{NO_UNTAINT_WARN};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"NO_UNTAINT_WARN"} 0 0 0
1090  
1091 {
1092 0 ▶ no warnings ('uninitialized'); # In case $ENV{$_} is set to undef.
Subroutine BEGIN: called CC=1 SCAR=0.2
1093 0 for (keys %ENV) {
1094 0 ($ENV{$_}) = $ENV{$_} =~ /(.*)/;
1095 }
1096 }
1097  
1098 # only accept dirs that are absolute and not world-writable
1099 $ENV{PATH} = $^O eq 'MSWin32' ?
1100 0 ▶ join ';', grep {not /^\./ and -d $_
Condition0%0/3
!/^\./ && -d $_
!ll&&!rl&&r
000
MC/DC0%0/2
!/^\./ && -d $_
!/^\./ -d $_
Truth table0%0/3
not(A) && B
A= !/^\./B= -d $_
ABresult
0X0
100
111
1101 } split /;/, $ENV{PATH}
1102 :
1103 0 ▶ join ':', grep {/^\// and -d $_ and $< == $> ? 1 : not (-W $_ or -O $_)
Branch: 1 branch
BranchTrueFalseTotal
$< == $> ? : 0 0 0
Condition0%0/9
m[^/] && -d $_ && ($< == $> ? 1 : !(-W $_ || -o $_))
!ll&&!rl&&r
000
m[^/] and -d $_
!ll&&!rl&&r
000
-W $_ || -o $_
l!l&&r!l&&!r
000
MC/DC0%0/3
m[^/] && -d $_ && ($< == $> ? 1 : !(-W $_ || -o $_))
m[^/] -d $_ ($< == $> ? 1 : !(-W $_ || -o $_))
MC/DC0%0/2
-W $_ || -o $_
-W $_ -o $_
Truth table0%0/4
A and B && C
A= m[^/]B= -d $_C= ($< == $> ? 1 : !(-W $_ || -o $_))
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/3
A || B
A= -W $_B= -o $_
ABresult
1X1
011
000
1104 0 ▶ } split /:/, $ENV{PATH};
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'MSWin32' ? : 0 0 0
1105  
1106 0 map {($_) = /(.*)/} @INC;
1107  
1108 # list cherry-picked from `perldoc perlrun`
1109 0 delete @ENV{qw(PERL5OPT PERL5SHELL PERL_ROOT IFS CDPATH ENV BASH_ENV)};
1110 0 ▶ $ENV{SHELL} = '/bin/sh' if -x '/bin/sh';
Branch: 1 branch
BranchTrueFalseTotal
if -x "/bin/sh" 0 0 0
1111  
1112 0 ▶ $< = $> if $< != $>; # so child processes retain euid - ignore failure
Branch: 1 branch
BranchTrueFalseTotal
if $< != $> 0 0 0
1113 }
1114 #==============================================================================
1115 # Blindly untaint tainted fields in Inline object.
1116 #==============================================================================
1117 0 ▶sub obj_untaint {
Subroutine obj_untaint: not called CC=2 SCAR=17.9
Pod undocumented
1118 0 my $o = shift;
1119 0 ▶ warn "In Inline::obj_untaint() : Blindly untainting tainted fields in Inline object.\n" unless $o->{CONFIG}{NO_UNTAINT_WARN};
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"CONFIG"}{"NO_UNTAINT_WARN"} 0 0 0
1120 0 ($o->{INLINE}{ILSM_module}) = $o->{INLINE}{ILSM_module} =~ /(.*)/;
1121 0 ($o->{API}{directory}) = $o->{API}{directory} =~ /(.*)/;
1122 0 ($o->{API}{build_dir}) = $o->{API}{build_dir} =~ /(.*)/;
1123 0 ($o->{CONFIG}{DIRECTORY}) = $o->{CONFIG}{DIRECTORY} =~ /(.*)/;
1124 0 ($o->{API}{install_lib}) = $o->{API}{install_lib} =~ /(.*)/;
1125 0 ($o->{API}{modpname}) = $o->{API}{modpname} =~ /(.*)/;
1126 0 ($o->{API}{modfname}) = $o->{API}{modfname} =~ /(.*)/;
1127 0 ($o->{API}{language}) = $o->{API}{language} =~ /(.*)/;
1128 0 ($o->{API}{pkg}) = $o->{API}{pkg} =~ /(.*)/;
1129 0 ($o->{API}{module}) = $o->{API}{module} =~ /(.*)/;
1130 }
1131  
1132 #==============================================================================
1133 # Clean the build directory from previous builds
1134 #==============================================================================
1135 0 ▶sub clean_build {
Subroutine clean_build: not called CC=6 SCAR=37.4
Pod undocumented
1136 0 my $o = shift;
1137  
1138 0 my $prefix = $o->{INLINE}{DIRECTORY};
1139 0 ▶ opendir(my $dh, $prefix)
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dh, $prefix or croak("Can't open build directory: $prefix for cleanup $!\n") 0 0 0
1140 or croak "Can't open build directory: $prefix for cleanup $!\n";
1141  
1142 0 ▶ while (my $dir = readdir($dh)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $dir = readdir $dh)) 0 0 0
1143 0 my $maybedir = File::Spec->catdir($prefix,$dir);
1144 0 ▶ if (($maybedir and -d $maybedir) and ($dir =~ /\w{36,}/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($maybedir and -d $maybedir and $dir =~ /\w{36,}/) 0 0 0
Condition0%0/6
$maybedir and -d $maybedir and $dir =~ /\w{36,}/
!ll&&!rl&&r
000
$maybedir and -d $maybedir
!ll&&!rl&&r
000
MC/DC0%0/3
$maybedir and -d $maybedir and $dir =~ /\w{36,}/
$maybedir -d $maybedir $dir =~ /\w{36,}/
Truth table0%0/4
A and B and C
A= $maybedirB= -d $maybedirC= $dir =~ /\w{36,}/
ABCresult
0XX0
10X0
1100
1111
1145 0 $o->rmpath($prefix,$dir);
1146 }
1147 }
1148  
1149 0 close $dh;
1150 }
1151  
1152 #==============================================================================
1153 # Apply a list of filters to the source code
1154 #==============================================================================
1155 0 ▶sub filter {
Subroutine filter: not called CC=4 SCAR=30.0
Pod undocumented
1156 0 my $o = shift;
1157 0 my $new_code = $o->{API}{code};
1158 0 for (@_) {
1159 0 ▶ croak M52_invalid_filter($_) unless ref;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $_ 0 0 0
1160 0 ▶ if (ref eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_ eq 'CODE') { } 0 0 0
1161 0 $new_code = $_->($new_code);
1162 }
1163 else {
1164 0 $new_code = $_->filter($o, $new_code);
1165 }
1166 }
1167 0 return $new_code;
1168 }
1169  
1170 #==============================================================================
1171 # User wants to report a bug
1172 #==============================================================================
1173 0 ▶sub reportbug {
Subroutine reportbug: not called CC=3 SCAR=21.9
Pod documented
1174 0 my $o = shift;
1175 0 ▶ return if $o->{INLINE}{reportbug_handled}++;
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"INLINE"}{"reportbug_handled"}++ 0 0 0
1176 0 print STDERR <<END;
1177 <-----------------------REPORTBUG Section------------------------------------->
1178  
1179 REPORTBUG mode in effect.
1180  
1181 Your Inline $o->{API}{language_id} code will be processed in the build directory:
1182  
1183 $o->{API}{build_dir}
1184  
1185 A perl-readable bug report including your perl configuration and run-time
1186 diagnostics will also be generated in the build directory.
1187  
1188 When the program finishes please bundle up the above build directory with:
1189  
1190 tar czf Inline.REPORTBUG.tar.gz $o->{API}{build_dir}
1191  
1192 and send "Inline.REPORTBUG.tar.gz" as an email attachment to the author
1193 of the offending Inline::* module with the subject line:
1194  
1195 REPORTBUG: Inline.pm
1196  
1197 Include in the email, a description of the problem and anything else that
1198 you think might be helpful. Patches are welcome! :-\)
1199  
1200 <-----------------------End of REPORTBUG Section------------------------------>
1201 END
1202 0 my %versions;
1203 {
1204 0 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
1205 0 %versions = map {eval "use $_();"; ($_, $ {$_ . '::VERSION'})}
1206 qw (Digest::MD5 Parse::RecDescent
1207 ExtUtils::MakeMaker File::Path FindBin
1208 Inline
1209 );
1210 }
1211  
1212 0 $o->mkpath($o->{API}{build_dir});
1213 open my $fh, ">", File::Spec->catfile($o->{API}{build_dir},"REPORTBUG")
1214 or croak M24_open_for_output_failed
1215 0 ▶ (File::Spec->catfile($o->{API}{build_dir},"REPORTBUG"));
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", "File::Spec"->catfile($o->{"API"}{"build_dir"}, "REPORTBUG") or croak(M24_open_for_output_failed("File::Spec"->catfile($o->{"API"}{"build_dir"}, "REPORTBUG"))) 0 0 0
1216 0 %Inline::REPORTBUG_Inline_Object = ();
1217 0 %Inline::REPORTBUG_Perl_Config = ();
1218 0 %Inline::REPORTBUG_Module_Versions = ();
1219 0 print $fh Inline::denter->new()
1220 ->indent(*REPORTBUG_Inline_Object, $o,
1221 *REPORTBUG_Perl_Config, \%Config::Config,
1222 *REPORTBUG_Module_Versions, \%versions,
1223 );
1224 0 close $fh;
1225 }
1226  
1227 #==============================================================================
1228 # Print a small report if PRINT_INFO option is set.
1229 #==============================================================================
1230 0 ▶sub print_info {
Subroutine print_info: not called CC=6 SCAR=33.9
Pod documented
1231 10 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
1232 0 my $o = shift;
1233  
1234 0 print STDERR <<END;
1235 <-----------------------Information Section----------------------------------->
1236  
1237 Information about the processing of your Inline $o->{API}{language_id} code:
1238  
1239 END
1240  
1241 0 ▶ print STDERR <<END if ($o->{INLINE}{object_ready});
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"INLINE"}{"object_ready"} 0 0 0
1242 Your module is already compiled. It is located at:
1243 $o->{API}{location}
1244  
1245 END
1246  
1247 0 ▶ print STDERR <<END if ($o->{INLINE}{object_ready} and $o->{CONFIG}{FORCE_BUILD});
Branch: 1 branch
BranchTrueFalseTotal
if $o->{"INLINE"}{"object_ready"} and $o->{"CONFIG"}{"FORCE_BUILD"} 0 0 0
Condition0%0/3
$o->{"INLINE"}{"object_ready"} and $o->{"CONFIG"}{"FORCE_BUILD"}
!ll&&!rl&&r
000
MC/DC0%0/2
$o->{"INLINE"}{"object_ready"} and $o->{"CONFIG"}{"FORCE_BUILD"}
$o->{"INLINE"}{"object_ready"} $o->{"CONFIG"}{"FORCE_BUILD"}
Truth table0%0/3
A and B
A= $o->{"INLINE"}{"object_ready"}B= $o->{"CONFIG"}{"FORCE_BUILD"}
ABresult
0X0
100
111
1248 But the FORCE_BUILD option is set, so your code will be recompiled.
1249 I\'ll use this build directory:
1250 $o->{API}{build_dir}
1251  
1252 and I\'ll install the executable as:
1253 $o->{API}{location}
1254  
1255 END
1256 0 ▶ print STDERR <<END if (not $o->{INLINE}{object_ready});
Branch: 1 branch
BranchTrueFalseTotal
unless $o->{"INLINE"}{"object_ready"} 0 0 0
1257 Your source code needs to be compiled. I\'ll use this build directory:
1258 $o->{API}{build_dir}
1259  
1260 and I\'ll install the executable as:
1261 $o->{API}{location}
1262  
1263 END
1264  
1265 0 eval {
1266 0 print STDERR $o->info;
1267 };
1268 0 ▶ print $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
1269  
1270 0 print STDERR <<END;
1271  
1272 <-----------------------End of Information Section---------------------------->
1273 END
1274 }
1275  
1276 #==============================================================================
1277 # Hand off this invocation to Inline::MakeMaker
1278 #==============================================================================
1279 0 ▶sub maker_utils {
Subroutine maker_utils: not called CC=1 SCAR=6.9
Pod undocumented
1280 0 require Inline::MakeMaker;
1281 0 goto &Inline::MakeMaker::utils;
1282 }
1283  
1284 #==============================================================================
1285 # Utility subroutines
1286 #==============================================================================
1287  
1288 #==============================================================================
1289 # Make a path
1290 #==============================================================================
1291 13 ▶sub mkpath {
Subroutine mkpath: called CC=3 SCAR=11.0
Pod undocumented
1292 10 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
1293 13 my ($o, $mkpath) = @_;
1294 13 my($volume,$dirs,$nofile) = File::Spec->splitpath($mkpath,1);
1295 13 my @parts = File::Spec->splitdir($dirs);
1296 13 my @done;
1297 13 foreach (@parts){
1298 130 push(@done,$_);
1299 130 my $path = File::Spec->catpath($volume,File::Spec->catdir(@done),"");
1300 130 _mkdir($path, 0777);
1301 }
1302 13 ▶ croak M53_mkdir_failed($mkpath)
Branch: 1 branch
BranchTrueFalseTotal
unless -d $mkpath 0 13 13
1303 unless -d $mkpath;
1304 }
1305  
1306 #==============================================================================
1307 # Nuke a path (nicely)
1308 #==============================================================================
1309 0 ▶sub rmpath {
Subroutine rmpath: not called CC=6 SCAR=33.6
Pod undocumented
1310 10 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
1311 0 my ($o, $prefix, $rmpath) = @_;
1312 # Nuke the target directory
1313 0 ▶ _rmtree(File::Spec->catdir($prefix ? ($prefix,$rmpath) : ($rmpath)));
Branch: 1 branch
BranchTrueFalseTotal
$prefix ? : 0 0 0
1314 # Remove any empty directories underneath the requested one
1315 0 my @parts = File::Spec->splitdir($rmpath);
1316 0 ▶ while (@parts){
Branch: 1 branch
BranchTrueFalseTotal
if (@parts) 0 0 0
1317 0 ▶ $rmpath = File::Spec->catdir($prefix ? ($prefix,@parts) : @parts);
Branch: 1 branch
BranchTrueFalseTotal
$prefix ? : 0 0 0
1318 0 ▶ ($rmpath) = $rmpath =~ /(.*)/ if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 0 0
1319 0 ▶ rmdir $rmpath
Branch: 1 branch
BranchTrueFalseTotal
rmdir $rmpath or last 0 0 0
1320 or last; # rmdir failed because dir was not empty
1321 0 pop @parts;
1322 }
1323 }
1324  
1325 0 ▶sub _rmtree {
Subroutine _rmtree: not called CC=14 SCAR=53.5
1326 0 my($roots) = @_;
1327 0 ▶ $roots = [$roots] unless ref $roots;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $roots 0 0 0
1328 0 my($root);
1329 0 foreach $root (@{$roots}) {
1330 0 ▶ if ( -d $root ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $root) { } 0 0 0
1331 0 my(@names,@paths);
1332 0 ▶ if (opendir my $dh, $root) {
Branch: 1 branch
BranchTrueFalseTotal
if (opendir my $dh, $root) { } 0 0 0
1333 0 @names = readdir $dh;
1334 0 closedir $dh;
1335 }
1336 else {
1337 0 croak M21_opendir_failed($root);
1338 }
1339  
1340 0 my $dot = File::Spec->curdir();
1341 0 my $dotdot = File::Spec->updir();
1342 0 foreach my $name (@names) {
1343 0 ▶ next if $name eq $dot or $name eq $dotdot;
Branch: 1 branch
BranchTrueFalseTotal
if $name eq $dot or $name eq $dotdot 0 0 0
Condition0%0/3
$name eq $dot or $name eq $dotdot
l!l&&r!l&&!r
000
MC/DC0%0/2
$name eq $dot or $name eq $dotdot
$name eq $dot $name eq $dotdot
Truth table0%0/3
A or B
A= $name eq $dotB= $name eq $dotdot
ABresult
1X1
011
000
1344 0 my $maybefile = File::Spec->catfile($root,$name);
1345 0 ▶ push(@paths,$maybefile),next if $maybefile and -f $maybefile;
Branch: 1 branch
BranchTrueFalseTotal
if $maybefile and -f $maybefile 0 0 0
Condition0%0/3
$maybefile and -f $maybefile
!ll&&!rl&&r
000
MC/DC0%0/2
$maybefile and -f $maybefile
$maybefile -f $maybefile
Truth table0%0/3
A and B
A= $maybefileB= -f $maybefile
ABresult
0X0
100
111
1346 0 push(@paths,File::Spec->catdir($root,$name));
1347 }
1348  
1349 0 _rmtree(\@paths);
1350 0 ▶ ($root) = $root =~ /(.*)/ if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 0 0
1351 0 ▶ rmdir($root) or croak M54_rmdir_failed($root);
Branch: 1 branch
BranchTrueFalseTotal
rmdir $root or croak(M54_rmdir_failed($root)) 0 0 0
1352 }
1353 else {
1354 0 ▶ ($root) = $root =~ /(.*)/ if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 0 0
1355 0 ▶ unlink($root) or croak M55_unlink_failed($root);
Branch: 1 branch
BranchTrueFalseTotal
unlink $root or croak(M55_unlink_failed($root)) 0 0 0
1356 }
1357 }
1358 }
1359  
1360 #==============================================================================
1361 # Find the 'Inline' directory to use.
1362 #==============================================================================
1363 10 my $TEMP_DIR;
1364 2 ▶sub find_temp_dir {
Subroutine find_temp_dir: called CC=36 SCAR=58.5
Pod undocumented
1365 2 ▶ return $TEMP_DIR if $TEMP_DIR;
Branch: 1 branch
BranchTrueFalseTotal
if $TEMP_DIR 1 1 2
1366  
1367 1 my ($temp_dir, $home, $bin, $cwd, $env);
1368 1 $temp_dir = '';
1369 1 ▶ $env = $ENV{PERL_INLINE_DIRECTORY} || '';
Condition50%1/2
$ENV{'PERL_INLINE_DIRECTORY'} || ''
l!l
01
MC/DC0%0/1
$ENV{'PERL_INLINE_DIRECTORY'} || ''
$ENV{'PERL_INLINE_DIRECTORY'}
Truth table50%1/2
A
A= $ENV{'PERL_INLINE_DIRECTORY'}
Aresult
11
00
1370 1 ▶ $home = $ENV{HOME} ? abs_path($ENV{HOME}) : '';
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'HOME'} ? : 1 0 1
1371  
1372 1 ▶ if ($env and
Branch: 2 branches
BranchTrueFalseTotal
if ($env and -d $env and -w $env) { } 0 1 1
elsif ($cwd = abs_path('.') and $cwd ne $home and -d 'File::Spec'->catdir($cwd, '.Inline') and -w 'File::Spec'->catdir($cwd, '.Inline')) { } 0 1 1
Condition33%2/6
$env and -d $env and -w $env
!ll&&!rl&&r
100
$env and -d $env
!ll&&!rl&&r
100
MC/DC0%0/3
$env and -d $env and -w $env
$env -d $env -w $env
Truth table25%1/4
A and B and C
A= $envB= -d $envC= -w $env
ABCresult
0XX0
10X0
1100
1111
1373 -d $env and
1374 -w $env) {
1375 0 $temp_dir = $env;
1376 }
1377 ▶ elsif ($cwd = abs_path('.') and
Condition33%3/9
$cwd = abs_path(".") and $cwd ne $home and -d "File::Spec"->catdir($cwd, ".Inline") and -w "File::Spec"->catdir($cwd, ".Inline")
!ll&&!rl&&r
100
$cwd = abs_path(".") and $cwd ne $home and -d "File::Spec"->catdir($cwd, ".Inline")
!ll&&!rl&&r
010
$cwd = abs_path(".") and $cwd ne $home
!ll&&!rl&&r
001
MC/DC0%0/4
$cwd = abs_path(".") and $cwd ne $home and -d "File::Spec"->catdir($cwd, ".Inline") and -w "File::Spec"->catdir($cwd, ".Inline")
$cwd = abs_path(".") $cwd ne $home -d "File::Spec"->catdir($cwd, ".Inline") -w "File::Spec"->catdir($cwd, ".Inline")
Truth table20%1/5
A and B and C and D
A= $cwd = abs_path(".")B= $cwd ne $homeC= -d "File::Spec"->catdir($cwd, ".Inline")D= -w "File::Spec"->catdir($cwd, ".Inline")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1378 $cwd ne $home and
1379 -d File::Spec->catdir($cwd,".Inline") and
1380 -w File::Spec->catdir($cwd,".Inline")) {
1381 0 $temp_dir = File::Spec->catdir($cwd,".Inline");
1382 }
1383 else {
1384 1 require FindBin ;
1385 1 ▶ if ($bin = $FindBin::Bin and
Branch: 6 branches
BranchTrueFalseTotal
if ($bin = $FindBin::Bin and -d 'File::Spec'->catdir($bin, '.Inline') and -w 'File::Spec'->catdir($bin, '.Inline')) { } 0 1 1
elsif ($home and -d 'File::Spec'->catdir($home, '.Inline') and -w 'File::Spec'->catdir($home, '.Inline')) { } 0 1 1
elsif (defined $cwd and $cwd and -d 'File::Spec'->catdir($cwd, $Inline::did) and -w 'File::Spec'->catdir($cwd, $Inline::did)) { } 0 1 1
elsif (defined $bin and $bin and -d 'File::Spec'->catdir($bin, $Inline::did) and -w 'File::Spec'->catdir($bin, $Inline::did)) { } 0 1 1
elsif (defined $cwd and $cwd and -d $cwd and -w $cwd and _mkdir('File::Spec'->catdir($cwd, $Inline::did), 511)) { } 1 0 1
elsif (defined $bin and $bin and -d $bin and -w $bin and _mkdir('File::Spec'->catdir($bin, $Inline::did), 511)) { } 0 0 0
Condition33%2/6
$bin = $FindBin::Bin and -d "File::Spec"->catdir($bin, ".Inline") and -w "File::Spec"->catdir($bin, ".Inline")
!ll&&!rl&&r
100
$bin = $FindBin::Bin and -d "File::Spec"->catdir($bin, ".Inline")
!ll&&!rl&&r
010
MC/DC0%0/3
$bin = $FindBin::Bin and -d "File::Spec"->catdir($bin, ".Inline") and -w "File::Spec"->catdir($bin, ".Inline")
$bin = $FindBin::Bin -d "File::Spec"->catdir($bin, ".Inline") -w "File::Spec"->catdir($bin, ".Inline")
Truth table25%1/4
A and B and C
A= $bin = $FindBin::BinB= -d "File::Spec"->catdir($bin, ".Inline")C= -w "File::Spec"->catdir($bin, ".Inline")
ABCresult
0XX0
10X0
1100
1111
1386 -d File::Spec->catdir($bin,".Inline") and
1387 -w File::Spec->catdir($bin,".Inline")) {
1388 0 $temp_dir = File::Spec->catdir($bin,".Inline");
1389 }
1390 ▶ elsif ($home and
Condition33%2/6
$home and -d "File::Spec"->catdir($home, ".Inline") and -w "File::Spec"->catdir($home, ".Inline")
!ll&&!rl&&r
100
$home and -d "File::Spec"->catdir($home, ".Inline")
!ll&&!rl&&r
010
MC/DC0%0/3
$home and -d "File::Spec"->catdir($home, ".Inline") and -w "File::Spec"->catdir($home, ".Inline")
$home -d "File::Spec"->catdir($home, ".Inline") -w "File::Spec"->catdir($home, ".Inline")
Truth table25%1/4
A and B and C
A= $homeB= -d "File::Spec"->catdir($home, ".Inline")C= -w "File::Spec"->catdir($home, ".Inline")
ABCresult
0XX0
10X0
1100
1111
1391 -d File::Spec->catdir($home,".Inline") and
1392 -w File::Spec->catdir($home,".Inline")) {
1393 0 $temp_dir = File::Spec->catdir($home,".Inline");
1394 }
1395 ▶ elsif (defined $cwd and $cwd and
Condition33%3/9
defined $cwd and $cwd and -d "File::Spec"->catdir($cwd, $Inline::did) and -w "File::Spec"->catdir($cwd, $Inline::did)
!ll&&!rl&&r
100
defined $cwd and $cwd and -d "File::Spec"->catdir($cwd, $Inline::did)
!ll&&!rl&&r
010
defined $cwd and $cwd
!ll&&!rl&&r
001
MC/DC0%0/4
defined $cwd and $cwd and -d "File::Spec"->catdir($cwd, $Inline::did) and -w "File::Spec"->catdir($cwd, $Inline::did)
defined $cwd $cwd -d "File::Spec"->catdir($cwd, $Inline::did) -w "File::Spec"->catdir($cwd, $Inline::did)
Truth table20%1/5
A and B and C and D
A= defined $cwdB= $cwdC= -d "File::Spec"->catdir($cwd, $Inline::did)D= -w "File::Spec"->catdir($cwd, $Inline::did)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1396 -d File::Spec->catdir($cwd, $did) and
1397 -w File::Spec->catdir($cwd, $did)) {
1398 0 $temp_dir = File::Spec->catdir($cwd, $did);
1399 }
1400 ▶ elsif (defined $bin and $bin and
Condition33%3/9
defined $bin and $bin and -d "File::Spec"->catdir($bin, $Inline::did) and -w "File::Spec"->catdir($bin, $Inline::did)
!ll&&!rl&&r
100
defined $bin and $bin and -d "File::Spec"->catdir($bin, $Inline::did)
!ll&&!rl&&r
010
defined $bin and $bin
!ll&&!rl&&r
001
MC/DC0%0/4
defined $bin and $bin and -d "File::Spec"->catdir($bin, $Inline::did) and -w "File::Spec"->catdir($bin, $Inline::did)
defined $bin $bin -d "File::Spec"->catdir($bin, $Inline::did) -w "File::Spec"->catdir($bin, $Inline::did)
Truth table20%1/5
A and B and C and D
A= defined $binB= $binC= -d "File::Spec"->catdir($bin, $Inline::did)D= -w "File::Spec"->catdir($bin, $Inline::did)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1401 -d File::Spec->catdir($bin, $did) and
1402 -w File::Spec->catdir($bin, $did)) {
1403 0 $temp_dir = File::Spec->catdir($bin, $did);
1404 }
1405 ▶ elsif (defined $cwd and $cwd and
Condition33%4/12
defined $cwd and $cwd and -d $cwd and -w $cwd and _mkdir("File::Spec"->catdir($cwd, $Inline::did), 511)
!ll&&!rl&&r
001
defined $cwd and $cwd and -d $cwd and -w $cwd
!ll&&!rl&&r
001
defined $cwd and $cwd and -d $cwd
!ll&&!rl&&r
001
defined $cwd and $cwd
!ll&&!rl&&r
001
MC/DC0%0/5
defined $cwd and $cwd and -d $cwd and -w $cwd and _mkdir("File::Spec"->catdir($cwd, $Inline::did), 511)
defined $cwd $cwd -d $cwd -w $cwd _mkdir("File::Spec"->catdir($cwd, $Inline::did), 511)
Truth table16%1/6
A and B and C and D and E
A= defined $cwdB= $cwdC= -d $cwdD= -w $cwdE= _mkdir("File::Spec"->catdir($cwd, $Inline::did), 511)
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
1406 -d $cwd and
1407 -w $cwd and
1408 _mkdir(File::Spec->catdir($cwd, $did), 0777)) {
1409 1 $temp_dir = File::Spec->catdir($cwd, $did);
1410 }
1411 ▶ elsif (defined $bin and $bin and
Condition0%0/12
defined $bin and $bin and -d $bin and -w $bin and _mkdir("File::Spec"->catdir($bin, $Inline::did), 511)
!ll&&!rl&&r
000
defined $bin and $bin and -d $bin and -w $bin
!ll&&!rl&&r
000
defined $bin and $bin and -d $bin
!ll&&!rl&&r
000
defined $bin and $bin
!ll&&!rl&&r
000
MC/DC0%0/5
defined $bin and $bin and -d $bin and -w $bin and _mkdir("File::Spec"->catdir($bin, $Inline::did), 511)
defined $bin $bin -d $bin -w $bin _mkdir("File::Spec"->catdir($bin, $Inline::did), 511)
Truth table0%0/6
A and B and C and D and E
A= defined $binB= $binC= -d $binD= -w $binE= _mkdir("File::Spec"->catdir($bin, $Inline::did), 511)
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
1412 -d $bin and
1413 -w $bin and
1414 _mkdir(File::Spec->catdir($bin, $did), 0777)) {
1415 0 $temp_dir = File::Spec->catdir($bin, $did);
1416 }
1417 }
1418  
1419 1 ▶ croak M56_no_DIRECTORY_found()
Branch: 1 branch
BranchTrueFalseTotal
unless $temp_dir 0 1 1
1420 unless $temp_dir;
1421 1 return $TEMP_DIR = abs_path($temp_dir);
1422 }
1423  
1424 131 ▶sub _mkdir {
Subroutine _mkdir: called CC=4 SCAR=14.5
1425 131 my $dir = shift;
1426 131 ▶ my $mode = shift || 0777;
Condition50%1/2
shift() || 511
l!l
1310
MC/DC0%0/1
shift() || 511
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
1427 131 ▶ ($dir) = ($dir =~ /(.*)/) if UNTAINT;
Branch: 1 branch
BranchTrueFalseTotal
if UNTAINT() 0 131 131
1428 131 $dir =~ s|[/\\:]$||;
1429 131 ▶ return mkdir($dir, $mode) || $!{EEXIST};
Condition66%2/3
mkdir($dir, $mode) || $!{'EEXIST'}
l!l&&r!l&&!r
241070
MC/DC0%0/2
mkdir($dir, $mode) || $!{'EEXIST'}
mkdir($dir, $mode) $!{'EEXIST'}
Truth table33%1/3
A || B
A= mkdir($dir, $mode)B= $!{'EEXIST'}
ABresult
1X1
011
000
1430 }
1431  
1432 #==============================================================================
1433 # Error messages
1434 #==============================================================================
1435  
1436 0 ▶sub M01_usage_use {
Subroutine M01_usage_use: not called CC=1 SCAR=6.9
Pod undocumented
1437 0 my ($module) = @_;
1438 0 return <<END;
1439 It is invalid to use '$module' directly. Please consult the Inline
1440 documentation for more information.
1441  
1442 END
1443 }
1444  
1445 0 ▶sub M02_usage {
Subroutine M02_usage: not called CC=2 SCAR=17.9
Pod undocumented
1446 0 my $usage = <<END;
1447 Invalid usage of Inline module. Valid usages are:
1448 use Inline;
1449 use Inline language => "source-string", config-pair-list;
1450 use Inline language => "source-file", config-pair-list;
1451 use Inline language => [source-line-list], config-pair-list;
1452 use Inline language => 'DATA', config-pair-list;
1453 use Inline language => 'Config', config-pair-list;
1454 use Inline Config => config-pair-list;
1455 use Inline with => module-list;
1456 use Inline shortcut-list;
1457 END
1458 # This is broken ????????????????????????????????????????????????????
1459 0 ▶ $usage .= <<END if defined $Inline::languages;
Branch: 1 branch
BranchTrueFalseTotal
if defined $Inline::languages 0 0 0
1460  
1461 Supported languages:
1462 0 ${\ join(', ', sort keys %$Inline::languages)}
1463  
1464 END
1465 0 return $usage;
1466 }
1467  
1468 0 ▶sub M03_usage_bind {
Subroutine M03_usage_bind: not called CC=2 SCAR=17.9
Pod undocumented
1469 0 my $usage = <<END;
1470 Invalid usage of the Inline->bind() function. Valid usages are:
1471 Inline->bind(language => "source-string", config-pair-list);
1472 Inline->bind(language => "source-file", config-pair-list);
1473 Inline->bind(language => [source-line-list], config-pair-list);
1474 END
1475  
1476 0 ▶ $usage .= <<END if defined $Inline::languages;
Branch: 1 branch
BranchTrueFalseTotal
if defined $Inline::languages 0 0 0
1477  
1478 Supported languages:
1479 0 ${\ join(', ', sort keys %$Inline::languages)}
1480  
1481 END
1482 0 return $usage;
1483 }
1484  
1485 0 ▶sub M04_error_nocode {
Subroutine M04_error_nocode: not called CC=1 SCAR=6.9
Pod undocumented
1486 0 my ($language) = @_;
1487 0 return <<END;
1488 No $language source code found for Inline.
1489  
1490 END
1491 }
1492  
1493 0 ▶sub M05_error_eval {
Subroutine M05_error_eval: not called CC=1 SCAR=6.9
Pod undocumented
1494 0 my ($subroutine, $msg) = @_;
1495 0 return <<END;
1496 An eval() failed in Inline::$subroutine:
1497 $msg
1498  
1499 END
1500 }
1501  
1502 0 ▶sub M06_code_file_failed_open {
Subroutine M06_code_file_failed_open: not called CC=1 SCAR=6.9
Pod undocumented
1503 0 my ($file) = @_;
1504 0 return <<END;
1505 Couldn't open Inline code file '$file':
1506 $!
1507  
1508 END
1509 #'
1510 }
1511  
1512 0 ▶sub M07_code_file_does_not_exist {
Subroutine M07_code_file_does_not_exist: not called CC=1 SCAR=6.9
Pod undocumented
1513 0 my ($file) = @_;
1514 0 return <<END;
1515 Inline assumes '$file' is a filename,
1516 and that file does not exist.
1517  
1518 END
1519 }
1520  
1521 0 ▶sub M08_no_DATA_source_code {
Subroutine M08_no_DATA_source_code: not called CC=1 SCAR=6.9
Pod undocumented
1522 0 my ($lang) = @_;
1523 0 return <<END;
1524 No source code in DATA section for Inline '$lang' section.
1525  
1526 END
1527 }
1528  
1529 0 ▶sub M09_marker_mismatch {
Subroutine M09_marker_mismatch: not called CC=1 SCAR=6.9
Pod undocumented
1530 0 my ($marker, $lang) = @_;
1531 0 return <<END;
1532 Marker '$marker' does not match Inline '$lang' section.
1533  
1534 END
1535 }
1536  
1537 0 ▶sub M10_usage_WITH_USING {
Subroutine M10_usage_WITH_USING: not called CC=1 SCAR=6.9
Pod undocumented
1538 0 return <<END;
1539 Config option WITH or USING must be a module name or an array ref
1540 of module names.
1541  
1542 END
1543 }
1544  
1545 0 ▶sub M11_usage_DIRECTORY {
Subroutine M11_usage_DIRECTORY: not called CC=1 SCAR=6.9
Pod undocumented
1546 0 my ($value) = @_;
1547 0 return <<END;
1548 Invalid value '$value' for config option DIRECTORY
1549  
1550 END
1551 }
1552  
1553 0 ▶sub M12_usage_NAME {
Subroutine M12_usage_NAME: not called CC=1 SCAR=6.9
Pod undocumented
1554 0 my ($name) = @_;
1555 0 return <<END;
1556 Invalid value for NAME config option: '$name'
1557  
1558 END
1559 }
1560  
1561 0 ▶sub M13_usage_VERSION {
Subroutine M13_usage_VERSION: not called CC=1 SCAR=6.9
Pod undocumented
1562 0 my ($version) = @_;
1563 0 return <<END;
1564 Invalid (according to version.pm) VERSION config option: '$version'
1565 (Should also be specified as a string rather than a floating point number)
1566  
1567 END
1568 }
1569  
1570 0 ▶sub M14_usage_Config {
Subroutine M14_usage_Config: not called CC=1 SCAR=6.9
Pod undocumented
1571 0 return <<END;
1572 As of Inline v0.30, use of the Inline::Config module is no longer supported
1573 or allowed. If Inline::Config exists on your system, it can be removed. See
1574 the Inline documentation for information on how to configure Inline.
1575  
1576 END
1577 }
1578  
1579 0 ▶sub M15_usage_install_directory {
Subroutine M15_usage_install_directory: not called CC=1 SCAR=6.9
Pod undocumented
1580 0 return <<END;
1581 Can't use the DIRECTORY option when installing an Inline extension module.
1582  
1583 END
1584 #'
1585 }
1586  
1587 0 ▶sub M16_DIRECTORY_mkdir_failed {
Subroutine M16_DIRECTORY_mkdir_failed: not called CC=1 SCAR=6.9
Pod undocumented
1588 0 my ($dir) = @_;
1589 0 return <<END;
1590 Can't mkdir $dir to build Inline code.
1591  
1592 END
1593 #'
1594 }
1595  
1596 0 ▶sub M17_config_open_failed {
Subroutine M17_config_open_failed: not called CC=1 SCAR=6.9
Pod undocumented
1597 0 my ($dir) = @_;
1598 0 my $file = File::Spec->catfile(${dir}, $configuration_file);
1599 0 return <<END;
1600 Can't open ${file} for input.
1601  
1602 END
1603 #'
1604 }
1605  
1606 0 ▶sub M18_error_old_version {
Subroutine M18_error_old_version: not called CC=2 SCAR=17.9
Pod undocumented
1607 0 my ($old_version, $directory) = @_;
1608 0 ▶ $old_version ||= '???';
Condition0%0/2
$old_version ||= "???"
l!l
00
MC/DC0%0/1
$old_version ||= "???"
$old_version
Truth table0%0/2
A
A= $old_version
Aresult
11
00
1609 0 return <<END;
1610 You are using Inline version $Inline::VERSION with a directory that was
1611 configured by Inline version $old_version. This version is no longer supported.
1612 Please delete the following directory and try again:
1613  
1614 $directory
1615  
1616 END
1617 }
1618  
1619 4 ▶sub M19_usage_language {
Subroutine M19_usage_language: called CC=2 SCAR=7.0
Pod undocumented
1620 4 my ($language, $directory) = @_;
1621 4 require Config;
1622 4 return <<END;
1623 Error. You have specified '$language' as an Inline programming language.
1624  
1625 I currently only know about the following languages:
1626 4 ▶ ${ defined $Inline::languages ?
Branch: 1 branch
BranchTrueFalseTotal
defined $Inline::languages ? : 4 0 4
1627 \ join(', ', sort keys %$Inline::languages) : \ ''
1628 }
1629  
1630 If you have installed a support module for this language, try deleting the
1631 config-${Config::Config{'archname'}}-$] file from the following Inline DIRECTORY, and run again:
1632  
1633 $directory
1634  
1635 (And if that works, please file a bug report.)
1636  
1637 END
1638 }
1639  
1640 0 ▶sub M20_config_creation_failed {
Subroutine M20_config_creation_failed: not called CC=1 SCAR=6.9
Pod undocumented
1641 0 my ($dir) = @_;
1642 0 my $file = File::Spec->catfile(${dir}, $configuration_file);
1643 0 return <<END;
1644 Failed to autogenerate ${file}.
1645  
1646 END
1647 }
1648  
1649 0 ▶sub M21_opendir_failed {
Subroutine M21_opendir_failed: not called CC=1 SCAR=6.9
Pod undocumented
1650 0 my ($dir) = @_;
1651 0 return <<END;
1652 Can't open directory '$dir'.
1653  
1654 END
1655 #'
1656 }
1657  
1658 0 ▶sub M22_usage_register {
Subroutine M22_usage_register: not called CC=1 SCAR=6.9
Pod undocumented
1659 0 my ($language, $error) = @_;
1660 0 return <<END;
1661 The module Inline::$language does not support the Inline API, because it does
1662 properly support the register() method. This module will not work with Inline
1663 and should be uninstalled from your system. Please advise your sysadmin.
1664  
1665 The following error was generating from this module:
1666 $error
1667  
1668 END
1669 }
1670  
1671 0 ▶sub M23_usage_alias_used {
Subroutine M23_usage_alias_used: not called CC=1 SCAR=6.9
Pod undocumented
1672 0 my ($new_mod, $alias, $old_mod) = @_;
1673 0 return <<END;
1674 The module Inline::$new_mod is attempting to define $alias as an alias.
1675 But $alias is also an alias for Inline::$old_mod.
1676  
1677 One of these modules needs to be corrected or removed.
1678 Please notify the system administrator.
1679  
1680 END
1681 }
1682  
1683 0 ▶sub M24_open_for_output_failed {
Subroutine M24_open_for_output_failed: not called CC=1 SCAR=6.9
Pod undocumented
1684 0 my ($file) = @_;
1685 0 return <<END;
1686 Can't open $file for output.
1687 $!
1688  
1689 END
1690 #'
1691 }
1692  
1693 0 ▶sub M25_no_WITH_support {
Subroutine M25_no_WITH_support: not called CC=1 SCAR=6.9
Pod undocumented
1694 0 my ($mod, $err) = @_;
1695 0 return <<END;
1696 You have requested "use Inline with => '$mod'"
1697 but '$mod' does not work with Inline.
1698  
1699 $err
1700  
1701 END
1702 }
1703  
1704 0 ▶sub M26_error_version_without_name {
Subroutine M26_error_version_without_name: not called CC=1 SCAR=6.9
Pod undocumented
1705 0 return <<END;
1706 Specifying VERSION option without NAME option is not permitted.
1707  
1708 END
1709 }
1710  
1711 0 ▶sub M27_module_not_indexed {
Subroutine M27_module_not_indexed: not called CC=1 SCAR=6.9
Pod undocumented
1712 0 my ($mod) = @_;
1713 0 return <<END;
1714 You are attempting to load an extension for '$mod',
1715 but there is no entry for that module in %INC.
1716  
1717 END
1718 }
1719  
1720 0 ▶sub M28_error_grokking_path {
Subroutine M28_error_grokking_path: not called CC=1 SCAR=6.9
Pod undocumented
1721 0 my ($path) = @_;
1722 0 return <<END;
1723 Can't calculate a path from '$path' in %INC
1724  
1725 END
1726 }
1727  
1728 0 ▶sub M29_error_relative_path {
Subroutine M29_error_relative_path: not called CC=1 SCAR=6.9
Pod undocumented
1729 0 my ($name, $path) = @_;
1730 0 return <<END;
1731 Can't load installed extension '$name'
1732 from relative path '$path'.
1733  
1734 END
1735 #'
1736 }
1737  
1738 0 ▶sub M30_error_no_obj {
Subroutine M30_error_no_obj: not called CC=1 SCAR=6.9
Pod undocumented
1739 0 my ($name, $pkg, $path) = @_;
1740 0 <<END;
1741 The extension '$name' is not properly installed in path:
1742 '$path'
1743  
1744 If this is a CPAN/distributed module, you may need to reinstall it on your
1745 system.
1746  
1747 To allow Inline to compile the module in a temporary cache, simply remove the
1748 Inline config option 'VERSION=' from the $pkg module.
1749  
1750 END
1751 }
1752  
1753 0 ▶sub M31_inline_open_failed {
Subroutine M31_inline_open_failed: not called CC=1 SCAR=6.9
Pod undocumented
1754 0 my ($file) = @_;
1755 0 return <<END;
1756 Can't open Inline validate file:
1757  
1758 $file
1759  
1760 $!
1761  
1762 END
1763 #'
1764 }
1765  
1766 0 ▶sub M32_error_md5_validation {
Subroutine M32_error_md5_validation: not called CC=1 SCAR=6.9
Pod undocumented
1767 0 my ($md5, $inl) = @_;
1768 0 return <<END;
1769 The source code fingerprint:
1770  
1771 $md5
1772  
1773 does not match the one in:
1774  
1775 $inl
1776  
1777 This module needs to be reinstalled.
1778  
1779 END
1780 }
1781  
1782 0 ▶sub M33_error_old_inline_version {
Subroutine M33_error_old_inline_version: not called CC=1 SCAR=6.9
Pod undocumented
1783 0 my ($inl) = @_;
1784 0 return <<END;
1785 The following extension is not compatible with this version of Inline.pm.
1786  
1787 $inl
1788  
1789 You need to reinstall this extension.
1790  
1791 END
1792 }
1793  
1794 0 ▶sub M34_error_incorrect_version {
Subroutine M34_error_incorrect_version: not called CC=1 SCAR=6.9
Pod undocumented
1795 0 my ($inl) = @_;
1796 0 return <<END;
1797 The version of your extension does not match the one indicated by your
1798 Inline source code, according to:
1799  
1800 $inl
1801  
1802 This module should be reinstalled.
1803  
1804 END
1805 }
1806  
1807 0 ▶sub M35_error_no_object_file {
Subroutine M35_error_no_object_file: not called CC=1 SCAR=6.9
Pod undocumented
1808 0 my ($obj, $inl) = @_;
1809 0 return <<END;
1810 There is no object file:
1811 $obj
1812  
1813 For Inline validation file:
1814 $inl
1815  
1816 This module should be reinstalled.
1817  
1818 END
1819 }
1820  
1821 0 ▶sub M36_usage_install_main {
Subroutine M36_usage_install_main: not called CC=1 SCAR=6.9
Pod undocumented
1822 0 return <<END;
1823 Can't install an Inline extension module from package 'main'.
1824  
1825 END
1826 #'
1827 }
1828  
1829 0 ▶sub M37_usage_install_auto {
Subroutine M37_usage_install_auto: not called CC=1 SCAR=6.9
Pod undocumented
1830 0 return <<END;
1831 Can't install an Inline extension module with AUTONAME enabled.
1832  
1833 END
1834 #'
1835 }
1836  
1837 0 ▶sub M38_usage_install_name {
Subroutine M38_usage_install_name: not called CC=1 SCAR=6.9
Pod undocumented
1838 0 return <<END;
1839 An Inline extension module requires an explicit NAME.
1840  
1841 END
1842 }
1843  
1844 0 ▶sub M39_usage_install_version {
Subroutine M39_usage_install_version: not called CC=1 SCAR=6.9
Pod undocumented
1845 0 return <<END;
1846 An Inline extension module requires an explicit VERSION.
1847  
1848 END
1849 }
1850  
1851 0 ▶sub M40_usage_install_badname {
Subroutine M40_usage_install_badname: not called CC=1 SCAR=6.9
Pod undocumented
1852 0 my ($name, $pkg) = @_;
1853 0 return <<END;
1854 The NAME '$name' is illegal for this Inline extension.
1855 The NAME must match the current package name:
1856 $pkg
1857  
1858 END
1859 }
1860  
1861 0 ▶sub M41_usage_install_version_mismatch {
Subroutine M41_usage_install_version_mismatch: not called CC=1 SCAR=6.9
Pod undocumented
1862 0 my ($mod_name, $mod_ver, $ext_name, $ext_ver) = @_;
1863 0 <<END;
1864 The version '$mod_ver' for module '$mod_name' doe not match
1865 the version '$ext_ver' for Inline section '$ext_name'.
1866  
1867 END
1868 }
1869  
1870 0 ▶sub M42_usage_loader {
Subroutine M42_usage_loader: not called CC=1 SCAR=6.9
Pod undocumented
1871 0 return <<END;
1872 ERROR. The loader that was invoked is for compiled languages only.
1873  
1874 END
1875 }
1876  
1877 0 ▶sub M43_error_bootstrap {
Subroutine M43_error_bootstrap: not called CC=1 SCAR=6.9
Pod undocumented
1878 0 my ($mod, $err) = @_;
1879 0 return <<END;
1880 Had problems bootstrapping Inline module '$mod'
1881  
1882 $err
1883  
1884 END
1885 }
1886  
1887 0 ▶sub M45_usage_with {
Subroutine M45_usage_with: not called CC=1 SCAR=6.9
Pod undocumented
1888 0 return <<END;
1889 Syntax error detected using 'use Inline with ...'.
1890 Should be specified as:
1891  
1892 use Inline with => 'module1', 'module2', ..., 'moduleN';
1893  
1894 END
1895 }
1896  
1897 0 ▶sub M46_usage_with_bad {
Subroutine M46_usage_with_bad: not called CC=1 SCAR=6.9
Pod undocumented
1898 0 my $mod = shift;
1899 0 return <<END;
1900 Syntax error detected using 'use Inline with => "$mod";'.
1901 '$mod' could not be found.
1902  
1903 END
1904 }
1905  
1906 0 ▶sub M47_invalid_config_option {
Subroutine M47_invalid_config_option: not called CC=1 SCAR=6.9
Pod undocumented
1907 0 my ($option) = @_;
1908 0 return <<END;
1909 Invalid Config option '$option'
1910  
1911 END
1912 #'
1913 }
1914  
1915 1 ▶sub M48_usage_shortcuts {
Subroutine M48_usage_shortcuts: called CC=1 SCAR=0.0
Pod undocumented
1916 1 my ($shortcut) = @_;
1917 1 return <<END;
1918 Invalid shortcut '$shortcut' specified.
1919  
1920 Valid shortcuts are:
1921 VERSION, INFO, FORCE, NOCLEAN, CLEAN, UNTAINT, SAFE, UNSAFE,
1922 GLOBAL, NOISY and REPORTBUG
1923  
1924 END
1925 }
1926  
1927 0 ▶sub M49_usage_unsafe {
Subroutine M49_usage_unsafe: not called CC=2 SCAR=17.9
Pod undocumented
1928 0 my ($terminate) = @_;
1929 return <<END .
1930 You are using the Inline.pm module with the UNTAINT and SAFEMODE options,
1931 but without specifying the DIRECTORY option. This is potentially unsafe.
1932 Either use the DIRECTORY option or turn off SAFEMODE.
1933  
1934 END
1935 0 ▶ ($terminate ? <<END : "");
Branch: 1 branch
BranchTrueFalseTotal
$terminate ? : 0 0 0
1936 Since you are running as a privileged user, Inline.pm is terminating.
1937  
1938 END
1939 }
1940  
1941 0 ▶sub M51_unused_DATA {
Subroutine M51_unused_DATA: not called CC=1 SCAR=6.9
Pod undocumented
1942 0 return <<END;
1943 One or more DATA sections were not processed by Inline.
1944  
1945 END
1946 }
1947  
1948 0 ▶sub M52_invalid_filter {
Subroutine M52_invalid_filter: not called CC=1 SCAR=6.9
Pod undocumented
1949 0 my ($filter) = @_;
1950 0 return <<END;
1951 Invalid filter '$filter' is not a reference.
1952  
1953 END
1954 }
1955  
1956 0 ▶sub M53_mkdir_failed {
Subroutine M53_mkdir_failed: not called CC=1 SCAR=6.9
Pod undocumented
1957 0 my ($dir) = @_;
1958 0 return <<END;
1959 Couldn't make directory path '$dir'.
1960  
1961 END
1962 #'
1963 }
1964  
1965 0 ▶sub M54_rmdir_failed {
Subroutine M54_rmdir_failed: not called CC=1 SCAR=6.9
Pod undocumented
1966 0 my ($dir) = @_;
1967 0 return <<END;
1968 Can't remove directory '$dir':
1969  
1970 $!
1971  
1972 END
1973 #'
1974 }
1975  
1976 0 ▶sub M55_unlink_failed {
Subroutine M55_unlink_failed: not called CC=1 SCAR=6.9
Pod undocumented
1977 0 my ($file) = @_;
1978 0 return <<END;
1979 Can't unlink file '$file':
1980  
1981 $!
1982  
1983 END
1984 #'
1985 }
1986  
1987 0 ▶sub M56_no_DIRECTORY_found {
Subroutine M56_no_DIRECTORY_found: not called CC=1 SCAR=6.9
Pod undocumented
1988 0 return <<END;
1989 Couldn't find an appropriate DIRECTORY for Inline to use.
1990  
1991 END
1992 #'
1993 }
1994  
1995 0 ▶sub M57_wrong_architecture {
Subroutine M57_wrong_architecture: not called CC=1 SCAR=6.9
Pod undocumented
1996 0 my ($ext, $arch, $thisarch) = @_;
1997 0 return <<END;
1998 The extension '$ext'
1999 is built for perl on the '$arch' platform.
2000 This is the '$thisarch' platform.
2001  
2002 END
2003 }
2004  
2005 0 ▶sub M58_site_install {
Subroutine M58_site_install: not called CC=1 SCAR=6.9
Pod undocumented
2006 0 return <<END;
2007 You have specified the SITE_INSTALL command. Support for this option has
2008 been removed from Inline since version 0.40. It has been replaced by the
2009 use of Inline::MakeMaker in your Makefile.PL. Please see the Inline
2010 documentation for more help on creating and installing Inline based modules.
2011  
2012 END
2013 }
2014  
2015 0 ▶sub M59_bad_inline_file {
Subroutine M59_bad_inline_file: not called CC=1 SCAR=6.9
Pod undocumented
2016 0 my ($lang) = @_;
2017 0 return <<END;
2018 Could not find any Inline source code for the '$lang' language using
2019 the Inline::Files module.
2020  
2021 END
2022 }
2023  
2024 0 ▶sub M60_no_inline_files {
Subroutine M60_no_inline_files: not called CC=1 SCAR=6.9
Pod undocumented
2025 0 return <<END;
2026 It appears that you have requested to use Inline with Inline::Files.
2027 You need to explicitly 'use Inline::Files;' before your 'use Inline'.
2028  
2029 END
2030 }
2031  
2032 0 ▶sub M61_not_parsed {
Subroutine M61_not_parsed: not called CC=1 SCAR=6.9
Pod undocumented
2033 0 return <<END;
2034 It does not appear that your program has been properly parsed by Inline::Files.
2035  
2036 END
2037 }
2038  
2039 0 ▶sub M62_invalid_config_file {
Subroutine M62_invalid_config_file: not called CC=1 SCAR=6.9
Pod undocumented
2040 0 my ($config) = @_;
2041 0 return <<END;
2042 You are using a config file that was created by an older version of Inline:
2043  
2044 $config
2045  
2046 This file and all the other components in its directory are no longer valid
2047 for this version of Inline. The best thing to do is simply delete all the
2048 contents of the directory and let Inline rebuild everything for you. Inline
2049 will do this automatically when you run your programs.
2050  
2051 END
2052 }
2053  
2054 0 ▶sub M63_no_source {
Subroutine M63_no_source: not called CC=1 SCAR=6.9
Pod undocumented
2055 0 my ($pkg) = @_;
2056 0 return <<END;
2057 This module $pkg can not be loaded and has no source code.
2058 You may need to reinstall this module.
2059  
2060 END
2061 }
2062  
2063 0 ▶sub M64_install_not_c {
Subroutine M64_install_not_c: not called CC=1 SCAR=6.9
Pod undocumented
2064 0 my ($lang) = @_;
2065 0 return <<END;
2066 Invalid attempt to install an Inline module using the '$lang' language.
2067  
2068 Only C and CPP (C++) based modules are currently supported.
2069  
2070 END
2071 }
2072  
2073 0 ▶sub M65_WITH_not_lang {
Subroutine M65_WITH_not_lang: not called CC=1 SCAR=6.9
Pod undocumented
2074 0 my ($mod, $lang) = @_;
2075 0 return <<END;
2076 $mod gave no 'with' hints for $lang.
2077 END
2078 }
2079  
2080 10 1;
« Inline/MakeMaker.pm ↑ Summary Inline/denter.pm »