Inline.pm

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