blib/lib/Perl/Config.pm

filter: Statementstmt 64.5% 200 / 310 Branchbran 39.1% 36 / 92 Conditioncond 27.0% 13 / 48 MC/DCmcdc 10.3% 3 / 29 Subroutinesub 64.5% 20 / 31 Podpod 0.0% 0 / 13 totaltotal 52.0% 272 / 523 CC 74 SCAR 35.1
CC
74
Cov
55%
analyze_class_symtab_entries
56.0
set_system_paths
53.6
filename_short_to_namespace_root_guess
42.0
CRAP 33.3
« blib/lib/Perl/Type/GMPInteger.pm ↑ Summary blib/lib/Perl/Structure/Hash/SubTypes2D.pm »
1 ## no critic qw(ProhibitUselessNoCritic PodSpelling ProhibitExcessMainComplexity) # DEVELOPER DEFAULT 1a: allow unreachable & POD-commented code, must be on line 1; SYSTEM SPECIAL 4: allow complex code outside subroutines, must be on line 1
2  
3 # DEV NOTE: this package exists to serve as the header file for Perl/Types.pm itself,
4 # as well as for Perl/Types.pm dependencies such as Class.pm, HelperFunctions_cpp.pm, and perltypes.pm
5 package Perl::Config;
6 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 our $VERSION = 0.017_000;
9 5 our $IS_PERL_CONFIG = 1; # DEV NOTE, CORRELATION #rp027: Perl::Config, MathPerl::Config, PhysicsPerl::Config, etc
10  
11 # [[[ CRITICS ]]]
12 ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator
13 ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils
14 ## no critic qw(ProhibitUnreachableCode RequirePodSections RequirePodAtEnd) # DEVELOPER DEFAULT 1b: allow POD & unreachable or POD-commented code, must be after line 1
15 ## no critic qw(ProhibitStringyEval) # SYSTEM DEFAULT 1: allow eval()
16 ## no critic qw(ProhibitExplicitStdin) # USER DEFAULT 4: allow <STDIN> prompt
17 ## no critic qw(Capitalization ProhibitMultiplePackages ProhibitReusedNames) # SYSTEM DEFAULT 3: allow multiple & lower case package names
18 ## no critic qw(ProhibitAutomaticExportation) # SYSTEM SPECIAL 14: allow global exports from Config.pm
19  
20 # [[[ PRE-DECLARED TYPES ]]]
21 # DEV NOTE: pre-declare base scalar data types, for use within their own Boolean.pm and Integer.pm etc files,
22 # as well as numerous other Perl::Types files which can `use Perl::Config;` but can't `use Perl::Type::Integer;` etc
23 package # hide from PAUSE indexing
24 void;
25 package # hide from PAUSE indexing
26 boolean;
27 package # hide from PAUSE indexing
28 nonsigned_integer;
29 package # hide from PAUSE indexing
30 integer;
31 package # hide from PAUSE indexing
32 number;
33 package # hide from PAUSE indexing
34 character;
35 package # hide from PAUSE indexing
36 string;
37  
38 # [[[ SWITCH CONTEXT BACK TO PRIMARY PACKAGE ]]]
39 package Perl::Config;
40 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 # [[[ EXPORTS ]]]
44 # NEED FIX: duplicate export code
45 # DEV NOTE: these essential modules are exported automatically into all code which calls `use Perl::Config;` or, by association,
46 # either `use Perl::Types;` or `use perltypes;`; done via EXPORTS below
47 5 ▶use Data::Dumper; # enable expressive Dumper() in addition to print(); LMPC #4: Thou Shalt ... Create ... Bug-Free, High-Quality Code ...
Subroutine BEGIN: called CC=1 SCAR=0.0
48 5 $Data::Dumper::Sortkeys = 1; # Dumper() output must sort hash keys for t/lib/Perl/Types/Test/Hash* etc.
49 5 ▶use English qw(-no_match_vars); # prefer more expressive @ARG over @_, etc; LMPC #23: Thou Shalt Not Use ... Punctuation Variables ...
Subroutine BEGIN: called CC=1 SCAR=0.0
50 5 ▶use Carp; # enable expressive carp()/croak() in addition to warn()/die(); LMPC #8: Thou Shalt ... Create Maintainable, Re-Grokkable Code ...
Subroutine BEGIN: called CC=1 SCAR=0.0
51 5 ▶use POSIX qw(ceil floor modf getcwd);
Subroutine BEGIN: called CC=1 SCAR=0.0
52 5 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
53  
54 # DEV NOTE, CORRELATION #rp008: can't include to_string(), type(), types(), name(), or scope_type_name_value() in @EXPORT here or in Perl:: namespace below
55 # DEV NOTE, CORRELATION #rp034: enable @ARG in all packages (class & non-class)
56 # export all symbols imported from essential modules
57 5 our @EXPORT = (@Data::Dumper::EXPORT, @English::EXPORT, @Carp::EXPORT, @POSIX::EXPORT);
58 5 our @EXPORT_OK = (@Data::Dumper::EXPORT_OK, @English::EXPORT_OK, @Carp::EXPORT_OK, @POSIX::EXPORT_OK);
59 # DEV NOTE: do not export individual variables such as $ARG or @ARG, causes unexplainable errors such as incorrect subroutine arguments;
60 # export subroutines and typeglobs only;
61 # "Exporting variables is not a good idea. They can change under the hood, provoking horrible effects at-a-distance that are too hard to track and to fix. Trust me: they are not worth it." https://perldoc.perl.org/Exporter#What-Not-to-Export
62 # @ARG == @_, $OS_ERROR == $ERRNO == $!, $EVAL_ERROR == $@, $CHILD_ERROR == $?, $EXECUTABLE_NAME == $^X, $PROGRAM_NAME == $0, $OSNAME == $^O
63 #our @EXPORT = qw(Dumper carp croak confess *ARG $OS_ERROR $EVAL_ERROR $CHILD_ERROR $EXECUTABLE_NAME $PROGRAM_NAME $OSNAME);
64  
65 5 1; # end of package
66  
67  
68 # [[[ ADDITIONAL PACKAGES SPECIAL ]]]
69 package # hide from PAUSE indexing
70 Perl;
71 5 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
72 5 ▶use IPC::Cmd qw(can_run); # to check for `reset`
Subroutine BEGIN: called CC=1 SCAR=0.0
73  
74 # [[[ CRITICS ]]]
75 ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator
76 ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils
77 ## no critic qw(ProhibitUnreachableCode RequirePodSections RequirePodAtEnd) # DEVELOPER DEFAULT 1b: allow POD & unreachable or POD-commented code, must be after line 1
78 ## no critic qw(ProhibitStringyEval) # SYSTEM DEFAULT 1: allow eval()
79 ## no critic qw(ProhibitExplicitStdin) # USER DEFAULT 4: allow <STDIN> prompt
80 ## no critic qw(Capitalization ProhibitMultiplePackages ProhibitReusedNames) # SYSTEM DEFAULT 3: allow multiple & lower case package names
81 ## no critic qw(ProhibitAutomaticExportation) # SYSTEM SPECIAL 14: allow global exports from Config.pm
82  
83 # [[[ EXPORTS SPECIAL ]]]
84 # export $Perl::MODES into all code which calls `use Perl;`
85 5 our $MODES = { # see perl_modes.txt for more info
86 0 => { ops => 'PERL', types => 'PERL' }, # NEED FIX: should be types => 'PERL_STATIC'
87 1 => { ops => 'CPP', types => 'PERL' }, # NEED FIX: should be types => 'PERL_STATIC'
88 2 => { ops => 'CPP', types => 'CPP' }
89 };
90  
91 # NEED FIX: duplicate export code
92 # DEV NOTE: these essential modules are exported automatically into all code which calls `use Perl;`; done via EXPORTS below
93 5 ▶use Data::Dumper; # enable expressive Dumper() in addition to print(); LMPC #4: Thou Shalt ... Create ... Bug-Free, High-Quality Code ...
Subroutine BEGIN: called CC=1 SCAR=0.0
94 5 $Data::Dumper::Sortkeys = 1; # Dumper() output must sort hash keys for t/lib/Perl/Types/Test/Hash* etc.
95 5 ▶use English qw(-no_match_vars); # prefer more expressive @ARG over @_, etc; LMPC #23: Thou Shalt Not Use ... Punctuation Variables ...
Subroutine BEGIN: called CC=1 SCAR=0.0
96 5 ▶use Carp; # allow expressive carp()/croak() in addition to warn()/die(); LMPC #8: Thou Shalt ... Create Maintainable, Re-Grokkable Code ...
Subroutine BEGIN: called CC=1 SCAR=0.0
97 5 ▶use POSIX qw(ceil floor modf getcwd);
Subroutine BEGIN: called CC=1 SCAR=0.0
98 5 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
99 # DEV NOTE, CORRELATION #rp034: enable @ARG in all packages (class & non-class)
100 # export all symbols imported from essential modules
101 5 our @EXPORT = (@Data::Dumper::EXPORT, @English::EXPORT, @Carp::EXPORT, @POSIX::EXPORT);
102 5 our @EXPORT_OK = (@Data::Dumper::EXPORT_OK, @English::EXPORT_OK, @Carp::EXPORT_OK, @POSIX::EXPORT_OK);
103  
104 # [[[ INCLUDES SPECIAL ]]]
105 5 ▶use File::Basename qw(fileparse);
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 # [[[ OO CLASS PROPERTIES SPECIAL ]]]
108  
109 # data type checking mode, disabled in Perl system code which calls 'use Perl;',
110 # changed on a per-file basis by preprocessor directive, see Perl::CompileUnit::Module::Class::INIT
111 # NEED UPGRADE: enable in Perl system code when bootstrapping compiler
112 5 our $CHECK = 'OFF';
113 5 our $VERBOSE = 0; # $Perl::VERBOSE & env var PERL_VERBOSE are equivalent, default to off, see verbose*() below
114 5 our $DEBUG = 0; # $Perl::DEBUG & env var PERL_DEBUG are equivalent, default to off, see debug*() & diag*() below
115 5 our $WARNINGS = 1; # $Perl::WARNINGS & env var PERL_WARNINGS are equivalent, default to on, see warn*() below
116 5 our $TYPES_CCFLAG = ' -D__CPP__TYPES'; # perltypes_mode.h & here default to CPPTYPES if PERLTYPES not explicitly set in this variable via perltypes::types_enable()
117 5 our $BASE_PATH = undef; # all target software lives below here
118 5 our $INCLUDE_PATH = undef; # all target system modules live here
119 5 our $SCRIPT_PATH = undef; # interpreted target system programs live here
120 5 our $CORE_PATH = undef; # all Perl core components (perl.h, etc) live here
121  
122 # DEV NOTE, CORRELATION #rp032: NEED UPGRADE: properly determine whether to use DBL_EPSILON or FLT_EPSILON below
123 5 ▶use constant EPSILON => POSIX::DBL_EPSILON();
Subroutine BEGIN: called CC=1 SCAR=0.0
124 #use constant EPSILON => POSIX::FLT_EPSILON();
125  
126 # [[[ SUBROUTINES SPECIAL ]]]
127  
128 # DEV NOTE, RPERL REFACTOR: copied filename_short_to_namespace_root_guess() from the old 'lib/RPerl/AfterSubclass.pm' module
129 # NEED ANSWER: does this subroutine really belong here in 'lib/Perl/Config.pm', or do we need to create `lib/Perl/HelperFunctions.pm` etc?
130 0 ▶sub filename_short_to_namespace_root_guess {
Subroutine filename_short_to_namespace_root_guess: not called CC=6 SCAR=37.4
Pod undocumented
131 0 ( my $filename_short ) = @ARG;
132 # print {*STDERR} 'in Perl::filename_short_to_namespace_root_guess(), received $filename_short = ' . $filename_short . "\n";
133 # # DEV NOTE, CORRELATION #rp021: remove hard-coded fake 'perl::' namespace?
134 0 ▶ if ($filename_short eq 'perl') { return 'perl::'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($filename_short eq "perl") 0 0 0
135 0 my $namespace_root = q{};
136 0 ( my $filename_prefix, my $filename_path, my $filename_suffix ) = fileparse( $filename_short, qr/[.][^.]*/xms );
137 # DEV NOTE: allow *.pl files to guess a namespace instead of empty string, both here and in filename_short_to_package_guess() below
138 # due to Perl core and/or Perl::Types deps calls to 'use' or 'require' *.pl files, such as Config_git.pl and Config_heavy.pl
139 # if ( $filename_suffix eq '.pm' ) {
140 0 ▶ if ( ( $filename_suffix eq '.pm' ) or ( $filename_suffix eq '.pl' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename_suffix eq ".pm" or $filename_suffix eq ".pl") 0 0 0
Condition0%0/3
$filename_suffix eq ".pm" or $filename_suffix eq ".pl"
l!l&&r!l&&!r
000
MC/DC0%0/2
$filename_suffix eq ".pm" or $filename_suffix eq ".pl"
$filename_suffix eq ".pm" $filename_suffix eq ".pl"
Truth table0%0/3
A or B
A= $filename_suffix eq ".pm"B= $filename_suffix eq ".pl"
ABresult
1X1
011
000
141 0 my $filename_path_split;
142 0 ▶ if ( $OSNAME eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Perl::OSNAME eq 'MSWin32') { } 0 0 0
143 0 $filename_path_split = [ split /[\/\\]/, $filename_path ];
144 #absolute paths cant go through here anymore, this was dropping the
145 #first part of the package on some modules
146 #shift @{$filename_path_split}; # discard leading drive letter
147 }
148 else {
149 0 $filename_path_split = [ split /\//, $filename_path ];
150 }
151  
152 # join then re-split in case there are no directories in path, only the *.pm filename
153 0 my $namespace_root_split = [ split /::/, ( join '::', ( @{$filename_path_split}, $filename_prefix ) ) ];
154 0 ▶ if ( $namespace_root_split->[0] eq '.' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($namespace_root_split->[0] eq ".") 0 0 0
155 0 shift @{$namespace_root_split};
156 }
157 # print {*STDERR} 'in Perl::filename_short_to_namespace_root_guess(), have $namespace_root_split = ' . Dumper($namespace_root_split) . "\n";
158 0 $namespace_root = $namespace_root_split->[0] . '::';
159 }
160 # print {*STDERR} 'in Perl::filename_short_to_namespace_root_guess(), about to return $namespace_root = ' . $namespace_root . "\n";
161 0 return $namespace_root;
162 }
163  
164  
165 # DEV NOTE, RPERL REFACTOR: copied post_processor__absolute_path_delete() from the old 'lib/RPerl/Compiler.pm' module
166 # NEED ANSWER: does this subroutine really belong here in 'lib/Perl/Config.pm', or do we need to create `lib/Perl/HelperFunctions.pm` etc?
167 # DEV NOTE, CORRELATION #rp055: handle removal of current directory & all @INC directories, so as not to hard-code system-specific dirs in #include statements
168 # remove unnecessary absolute paths
169 0 ▶sub post_processor__absolute_path_delete {
Subroutine post_processor__absolute_path_delete: not called CC=3 SCAR=24.8
Pod undocumented
170 0 { my string $RETURN_TYPE };
171 0 ( my string $input_path ) = @ARG;
172  
173 #Perl::diag( 'in Perl::post_processor__absolute_path_delete(), received $input_path = ' . $input_path . "\n" );
174  
175 # replace M$ backslashes with *nix forward slashes as path delimiter characters
176 0 ▶ if ( $OSNAME eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Perl::OSNAME eq "MSWin32") 0 0 0
177 0 $input_path =~ s/\\/\//gxms;
178 #Perl::diag( 'in Perl::post_processor__absolute_path_delete(), Windows OS detected, have possibly-reformatted $input_path = ' . $input_path . "\n" );
179 }
180  
181 # get the CWD, which we want to remove from the $input_path
182 0 my string $current_working_directory = getcwd();
183  
184 #Perl::diag( 'in Perl::post_processor__absolute_path_delete(), have $current_working_directory = ' . $current_working_directory . "\n" );
185  
186 # if $input_path starts with $current_working_directory, then remove the CWD and return
187 0 ▶ if ( ( substr $input_path, 0, ( length $current_working_directory ) ) eq $current_working_directory ) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($input_path, 0, length $current_working_directory) eq $current_working_directory) 0 0 0
188 0 return substr $input_path, ( ( length $current_working_directory ) + 1 );
189 }
190  
191 #Perl::diag( 'in Perl::post_processor__absolute_path_delete(), about to return $input_path = ' . $input_path . "\n" );
192  
193 # else return the unmodified $input_path
194 0 return $input_path;
195 }
196  
197  
198 # use a possibly-compiled Perl package during runtime
199 0 ▶sub eval_use {
Subroutine eval_use: not called CC=5 SCAR=34.0
Pod undocumented
200 0 (my $package_name, my $display_errors) = @ARG;
201 # Perl::debug('in Perl::eval_use(), received $package_name = ', $package_name, "\n");
202 # Perl::debug('in Perl::eval_use(), CHECKPOINT c000', "\n");
203  
204 0 my $INC_ref_pre = {};
205 0 foreach my $INC_key_pre (keys %INC) { $INC_ref_pre->{$INC_key_pre} = 1; }
206 # Perl::debug('in Perl::eval_use(), have $INC_ref_pre = ', Dumper($INC_ref_pre), "\n");
207 # Perl::debug('in Perl::eval_use(), CHECKPOINT c001', "\n");
208  
209 0 my $eval_string =<<"EOL";
210 # no warnings 'all'; # DOES NOT SUPPRESS
211 local \$SIG{__WARN__} = sub {}; # DOES SUPPRESS
212 # BEGIN { Perl::debug('in Perl::eval_use() eval, about to call use $package_name...', "\\n"); }
213  
214 # use $package_name; # DOES NOT SUPPRESS, THIS IS THE HIDDEN PERPETRATOR OF UNSUPPRESSABLE WARNINGS! 'Too late to call INIT block' inside multi-class module files
215 require $package_name; # DOES SUPPRESS
216  
217 # BEGIN { Perl::debug('in Perl::eval_use() eval, ret from use $package_name...', "\\n"); }
218  
219 # detect compiled C++ code and call cpp_load() accordingly
220 if (defined \&$package_name\:\:cpp_load) {
221 # Perl::debug('in Perl::eval_use() eval, $package_name\:\:cpp_load() is defined, calling...', "\\n");
222 $package_name\:\:cpp_load();
223 # Perl::debug('in Perl::eval_use() eval, $package_name\:\:cpp_load() is defined, returned from call', "\\n");
224 }
225 # else { Perl::debug('in Perl::eval_use() eval, $package_name\:\:cpp_load() is NOT defined, skipping...', "\\n"); }
226 EOL
227  
228 # Perl::debug('in Perl::eval_use(), have $eval_string = ', "\n\n", $eval_string, "\n\n");
229 # Perl::debug('in Perl::eval_use(), CHECKPOINT c002', "\n");
230  
231 0 $eval_string .=<<'EOL';
232 my $INC_ref_post = {};
233 foreach my $INC_key_post (keys %INC) {
234 if (not exists $INC_ref_pre->{$INC_key_post}) {
235 $INC_ref_post->{$INC_key_post} = $INC{$INC_key_post};
236 }
237 }
238 # Perl::debug('in Perl::eval_use() eval, have $INC_ref_post = ', Dumper($INC_ref_post), "\n");
239 Perl::CompileUnit::Module::Class::create_symtab_entries_and_accessors_mutators($INC_ref_post);
240 EOL
241 # Perl::debug('in Perl::eval_use(), CHECKPOINT c003', "\n");
242  
243 0 my $eval_retval = eval $eval_string;
244 # Perl::debug('in Perl::eval_use(), CHECKPOINT c004', "\n");
245  
246 # FOR DEBUG PURPOSES
247 # if (defined $eval_retval) { print 'have $eval_retval = ', $eval_retval, "\n"; }
248 # else { print 'have $eval_retval = undef, have $EVAL_ERROR = ', $EVAL_ERROR, "\n"; }
249  
250 0 ▶ if ($display_errors and (defined $EVAL_ERROR) and ($EVAL_ERROR ne q{})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($display_errors and defined $Perl::EVAL_ERROR and $Perl::EVAL_ERROR ne "") 0 0 0
Condition0%0/6
$display_errors and defined $Perl::EVAL_ERROR and $Perl::EVAL_ERROR ne ""
!ll&&!rl&&r
000
$display_errors and defined $Perl::EVAL_ERROR
!ll&&!rl&&r
000
MC/DC0%0/3
$display_errors and defined $Perl::EVAL_ERROR and $Perl::EVAL_ERROR ne ""
$display_errors defined $Perl::EVAL_ERROR $Perl::EVAL_ERROR ne ""
Truth table0%0/4
A and B and C
A= $display_errorsB= defined $Perl::EVAL_ERRORC= $Perl::EVAL_ERROR ne ""
ABCresult
0XX0
10X0
1100
1111
251 0 Perl::warning( 'WARNING WCOEU00, EVAL USE: Failed to eval-use package ' . q{'}
252 . $package_name . q{'} . ', fatal error trapped and delayed' . "\n" );
253 0 Perl::diag( ' Trapped the following error message...' . "\n\n" . $EVAL_ERROR . "\n" );
254 0 Perl::warning("\n");
255 }
256 # Perl::debug('in Perl::eval_use(), CHECKPOINT c005', "\n");
257  
258 0 return $eval_retval;
259 }
260  
261  
262 # NEED UPGRADE: replace Data::Dumper with pure-Perl equivalent?
263 #sub DUMPER {
264 # ( my $dumpee ) = @ARG;
265 # die ('in Perl::DUMPER(), received undef argument, dying') if (not(defined($_[0])));
266 # return '**UNDEF**' if ( not( defined $dumpee ) );
267 # return $dumpee->DUMPER()
268 # if ( defined( eval( q{$} . ref($dumpee) . q{::DUMPER} ) ) );
269 # return Dumper($dumpee);
270 #}
271  
272  
273 # DEV NOTE: to make verbose*() & diag*() & debug*() & warning() truly variadic, do not accept args as first line in subroutine
274  
275 # print verbose user-friendly message to STDOUT, if either PERL_VERBOSE environmental variable or $Perl::VERBOSE global variable are true
276 0 ▶sub verbose {
Subroutine verbose: not called CC=3 SCAR=24.8
Pod undocumented
277 # DEV NOTE, CORRELATION #rp017: default to off; if either variable is set to true, then do emit messages
278 0 ▶ if ( $ENV{PERL_VERBOSE} or $Perl::VERBOSE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"PERL_VERBOSE"} or $Perl::VERBOSE) 0 0 0
Condition0%0/3
$ENV{"PERL_VERBOSE"} or $Perl::VERBOSE
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{"PERL_VERBOSE"} or $Perl::VERBOSE
$ENV{"PERL_VERBOSE"} $Perl::VERBOSE
Truth table0%0/3
A or B
A= $ENV{"PERL_VERBOSE"}B= $Perl::VERBOSE
ABresult
1X1
011
000
279 0 print {*STDOUT} @ARG;
280 }
281 0 return 1;
282 }
283  
284  
285 # same as verbose(), except require <ENTER> to continue
286 0 ▶sub verbose_pause {
Subroutine verbose_pause: not called CC=3 SCAR=24.8
Pod undocumented
287 0 ▶ if ( $ENV{PERL_VERBOSE} or $Perl::VERBOSE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"PERL_VERBOSE"} or $Perl::VERBOSE) 0 0 0
Condition0%0/3
$ENV{"PERL_VERBOSE"} or $Perl::VERBOSE
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{"PERL_VERBOSE"} or $Perl::VERBOSE
$ENV{"PERL_VERBOSE"} $Perl::VERBOSE
Truth table0%0/3
A or B
A= $ENV{"PERL_VERBOSE"}B= $Perl::VERBOSE
ABresult
1X1
011
000
288 0 print {*STDOUT} @ARG;
289 0 my $stdin_ignore = <STDIN>;
290 }
291 0 return 1;
292 }
293  
294  
295 # clear STDOUT, if either PERL_VERBOSE environmental variable or $Perl::VERBOSE global variable are true
296 0 ▶sub verbose_clear_screen {
Subroutine verbose_clear_screen: not called CC=6 SCAR=37.4
Pod undocumented
297 0 ▶ if ( $ENV{PERL_VERBOSE} or $Perl::VERBOSE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"PERL_VERBOSE"} or $Perl::VERBOSE) 0 0 0
Condition0%0/3
$ENV{"PERL_VERBOSE"} or $Perl::VERBOSE
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{"PERL_VERBOSE"} or $Perl::VERBOSE
$ENV{"PERL_VERBOSE"} $Perl::VERBOSE
Truth table0%0/3
A or B
A= $ENV{"PERL_VERBOSE"}B= $Perl::VERBOSE
ABresult
1X1
011
000
298 0 ▶ if ( $OSNAME eq 'linux' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($Perl::OSNAME eq 'linux') { } 0 0 0
elsif ($Perl::OSNAME eq 'MSWin32') { } 0 0 0
299 0 my $reset_path = can_run('reset');
300 0 ▶ if ( defined $reset_path ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $reset_path) 0 0 0
301 0 system $reset_path;
302 }
303 }
304 elsif ( $OSNAME eq 'MSWin32' ) {
305  
306 # cls is a shell builtin, not a command which can be found by can_run()
307 0 system 'cls';
308 }
309 else {
310 0 Perl::warning(
311 q{WARNING WOSCLSC00: Unknown operating system '} . $OSNAME . q{' where 'linux' or 'Win32' expected, skipping screen clearing} . "\n" );
312 0 return 0;
313 }
314 }
315 0 return 1;
316 }
317  
318  
319 # DEV NOTE: diag() is simply a wrapper around debug(), they are 100% equivalent; likewise diag_pause() and debug_pause()
320 0 ▶sub diag { return debug(@ARG); }
Subroutine diag: not called CC=1 SCAR=6.9
Pod undocumented
321 0 ▶sub diag_pause { return debug_pause(@ARG); }
Subroutine diag_pause: not called CC=1 SCAR=6.9
Pod undocumented
322  
323  
324 # print debugging AKA diagnostic message to STDERR, if either PERL_DEBUG environmental variable or $Perl::DEBUG global variable are true
325 0 ▶sub debug {
Subroutine debug: not called CC=3 SCAR=24.8
Pod undocumented
326 # print {*STDERR} 'in debug(), have $ENV{PERL_DEBUG} = ' . $ENV{PERL_DEBUG} . "\n";
327  
328 # DEV NOTE, CORRELATION #rp017: default to off; if either variable is set to true, then do emit messages
329 0 ▶ if ( $ENV{PERL_DEBUG} or $Perl::DEBUG ) { print {*STDERR} @ARG; }
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"PERL_DEBUG"} or $Perl::DEBUG) 0 0 0
Condition0%0/3
$ENV{"PERL_DEBUG"} or $Perl::DEBUG
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{"PERL_DEBUG"} or $Perl::DEBUG
$ENV{"PERL_DEBUG"} $Perl::DEBUG
Truth table0%0/3
A or B
A= $ENV{"PERL_DEBUG"}B= $Perl::DEBUG
ABresult
1X1
011
000
330  
331 # if ( $ENV{PERL_DEBUG} or $Perl::DEBUG ) { print {*STDERR} "\e[1;31m $message \e[0m"; } # print in red
332 0 return 1; # DEV NOTE: this must be here to avoid 'at -e line 0. INIT failed--call queue aborted.'... BUT WHY???
333 }
334  
335  
336 # same as debug(), except require <ENTER> to continue
337 0 ▶sub debug_pause {
Subroutine debug_pause: not called CC=3 SCAR=24.8
Pod undocumented
338 0 ▶ if ( $ENV{PERL_DEBUG} or $Perl::DEBUG ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"PERL_DEBUG"} or $Perl::DEBUG) 0 0 0
Condition0%0/3
$ENV{"PERL_DEBUG"} or $Perl::DEBUG
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{"PERL_DEBUG"} or $Perl::DEBUG
$ENV{"PERL_DEBUG"} $Perl::DEBUG
Truth table0%0/3
A or B
A= $ENV{"PERL_DEBUG"}B= $Perl::DEBUG
ABresult
1X1
011
000
339 0 print {*STDERR} @ARG;
340 0 my $stdin_ignore = <STDIN>;
341 }
342 0 return 1;
343 }
344  
345  
346 # print non-fatal warning message to STDERR, unless either PERL_WARNINGS environmental variable or $Perl::WARNINGS global variable are false
347 5 ▶sub warning {
Subroutine warning: called CC=4 SCAR=14.0
Pod undocumented
348 # default to on; if either variable is set to false, then do not emit messages
349 5 ▶ if ( ( ( not defined $ENV{PERL_WARNINGS} ) or $ENV{PERL_WARNINGS} )
Branch: 1 branch
BranchTrueFalseTotal
if (!defined($ENV{"PERL_WARNINGS"}) || $ENV{"PERL_WARNINGS"} and $Perl::WARNINGS) 1 4 5
Condition66%4/6
!defined($ENV{"PERL_WARNINGS"}) || $ENV{"PERL_WARNINGS"} and $Perl::WARNINGS
!ll&&!rl&&r
401
not defined $ENV{"PERL_WARNINGS"} or $ENV{"PERL_WARNINGS"}
l!l&&r!l&&!r
104
MC/DC33%1/3
!defined($ENV{"PERL_WARNINGS"}) || $ENV{"PERL_WARNINGS"} and $Perl::WARNINGS
not defined $ENV{"PERL_WARNINGS"} $ENV{"PERL_WARNINGS"} $Perl::WARNINGS
Truth table40%2/5
not(A) or B and C
A= not defined $ENV{"PERL_WARNINGS"}B= $ENV{"PERL_WARNINGS"}C= $Perl::WARNINGS
ABCresult
00X0
1X00
0100
1X11
0111
350 and $Perl::WARNINGS )
351 {
352 # NEED ADDRESS? the two following lines should be equivalent, but warn causes false ECOPAPL03
353 1 print {*STDERR} @ARG;
354  
355 # warn $message . "\n";
356 }
357 5 return 1;
358 }
359  
360  
361 0 ▶sub analyze_class_symtab_entries {
Subroutine analyze_class_symtab_entries: not called CC=7 SCAR=40.3
Pod undocumented
362 0 ( my $class ) = @ARG;
363 0 my $retval = q{};
364 0 my @isa_array = eval q{@} . $class . q{::ISA};
365  
366 #print Dumper(\@isa_array);
367 0 my $isa_string = join ', ', @isa_array;
368 0 $retval .= '<<<<< BEGIN SYMTAB ENTRIES >>>>>' . "\n";
369 0 $retval .= $class . ' ISA (' . $isa_string . ')' . "\n\n";
370  
371 #foreach my $entry ( sort keys %Perl::CompileUnit::Module::Header:: ) {
372 0 my @keys = eval q{sort keys %} . $class . q{::};
373 0 foreach my $entry (@keys) {
374  
375 # my $glob = $Perl::CompileUnit::Module::Header::{$entry};
376 0 my $glob = eval q{$} . $class . q{::{$entry}};
377  
378 0 $retval .= q{-} x 50;
379 0 $retval .= "\n";
380 0 $retval .= $entry . "\n";
381  
382 # $retval .= ref \$glob, "\n"; # always says GLOB
383  
384 0 ▶ if ( defined ${$glob} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined ${$glob;}) 0 0 0
385 0 $retval .= "\t" . 'scalar';
386 0 my $ref_type = ref ${$glob};
387 0 ▶ if ( $ref_type ne q{} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ref_type ne "") 0 0 0
388 0 $retval .= "\t" . $ref_type . 'ref';
389 }
390 }
391 0 ▶ if ( @{$glob} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$glob;}) 0 0 0
392 0 $retval .= "\t" . 'array';
393 }
394 0 ▶ if ( %{$glob} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (%{$glob;}) 0 0 0
395 0 $retval .= "\t" . 'hash';
396 }
397 0 ▶ if ( defined &{$glob} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &{$glob;}) 0 0 0
398 0 $retval .= "\t" . 'code';
399 }
400  
401 0 $retval .= "\n";
402 }
403 0 $retval .= '<<<<< END SYMTAB ENTRIES >>>>>' . "\n";
404 0 return $retval;
405 }
406  
407  
408 # [ AUTOMATICALLY SET SYSTEM-DEPENDENT PATH VARIABLES ]
409 5 ▶sub set_system_paths {
Subroutine set_system_paths: called CC=41 SCAR=39.8
Pod undocumented
410 5 ( my $target_file_name_config, my $target_package_name_config, my $target_file_name_pm, my $target_file_name_script ) = @ARG;
411 5 ▶ if (( not exists $INC{$target_file_name_config} )
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $INC{$target_file_name_config} and defined $INC{$target_file_name_config}) 0 5 5
Condition33%1/3
exists $INC{$target_file_name_config} and defined $INC{$target_file_name_config}
!ll&&!rl&&r
005
MC/DC0%0/2
exists $INC{$target_file_name_config} and defined $INC{$target_file_name_config}
exists $INC{$target_file_name_config} defined $INC{$target_file_name_config}
Truth table33%1/3
A and B
A= exists $INC{$target_file_name_config}B= defined $INC{$target_file_name_config}
ABresult
0X0
100
111
412 or ( not defined $INC{$target_file_name_config} )
413 )
414 {
415 0 Carp::croak 'BIZARRE ERROR EINPL00: Non-existent or undefined Perl %INC path entry for '
416 . $target_file_name_config
417 . ', reported from within '
418 . $target_package_name_config
419 . ', croaking';
420 }
421 5 my $target_config_pm_loaded = $INC{$target_file_name_config};
422 5 ▶ if ( not -e $target_config_pm_loaded ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $target_config_pm_loaded) 0 5 5
423 0 Carp::croak 'BIZARRE ERROR EINPL01: Non-existent file ',
424 $target_config_pm_loaded,
425 ' supposedly loaded in %INC, reported from within ' . $target_package_name_config . ', croaking';
426 }
427 5 ( my $volume_loaded, my $directories_loaded, my $file_loaded ) = File::Spec->splitpath( $target_config_pm_loaded, my $no_file = 0 );
428 5 my @directories_loaded_split = File::Spec->splitdir($directories_loaded);
429  
430 #print {*STDERR} 'in ' . $target_package_name_config . ', have pre-pop @directories_loaded_split = ', "\n", Dumper(@directories_loaded_split), "\n";
431  
432 # pop twice if empty entry on top
433 5 ▶ if ( pop @directories_loaded_split eq q{} ) { pop @directories_loaded_split; }
Branch: 1 branch
BranchTrueFalseTotal
if (pop @directories_loaded_split eq "") 5 0 5
434 5 my $target_pm_wanted = File::Spec->catpath( $volume_loaded, ( File::Spec->catdir(@directories_loaded_split) ), $target_file_name_pm );
435  
436 #print {*STDERR} 'in ' . $target_package_name_config . ', have post-pop @directories_loaded_split = ', "\n", Dumper(@directories_loaded_split), "\n";
437 #print {*STDERR} 'in ' . $target_package_name_config . ', have $target_config_pm_loaded = ', $target_config_pm_loaded, "\n";
438 #print {*STDERR} 'in ' . $target_package_name_config . ', have $target_pm_wanted = ', $target_pm_wanted, "\n";
439  
440 5 my $target_pm_loaded = undef;
441 5 ▶ if ( ( exists $INC{$target_file_name_pm} ) and ( defined $INC{$target_file_name_pm} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $INC{$target_file_name_pm} and defined $INC{$target_file_name_pm}) 0 5 5
Condition33%1/3
exists $INC{$target_file_name_pm} and defined $INC{$target_file_name_pm}
!ll&&!rl&&r
500
MC/DC0%0/2
exists $INC{$target_file_name_pm} and defined $INC{$target_file_name_pm}
exists $INC{$target_file_name_pm} defined $INC{$target_file_name_pm}
Truth table33%1/3
A and B
A= exists $INC{$target_file_name_pm}B= defined $INC{$target_file_name_pm}
ABresult
0X0
100
111
442 0 $target_pm_loaded = $INC{$target_file_name_pm};
443  
444 # BULK88 20150608 2015.159: Win32 Bug Fix
445 # if ( not -e $target_pm_loaded ) {
446 0 ▶ if ( not -f $target_pm_loaded ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $target_pm_loaded) 0 0 0
447 0 Carp::croak 'BIZARRE ERROR EINPL02: Non-existent file ', $target_pm_loaded,
448 ' supposedly loaded in %INC, reported from within ' . $target_package_name_config . ', croaking';
449 }
450 }
451  
452 # strip trailing '/'
453 5 ▶ if ( ( substr $directories_loaded, -1, 1 ) eq q{/} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($directories_loaded, -1, 1) eq "/") 5 0 5
454 5 $directories_loaded = substr $directories_loaded, 0, -1;
455 }
456  
457 #print {*STDERR} 'in ' . $target_package_name_config . ', have $directories_loaded = ', $directories_loaded, "\n";
458 #print {*STDERR} 'in ' . $target_package_name_config . ', have $target_pm_loaded = ', ( $target_pm_loaded or '<undef>' ), "\n";
459  
460 5 my $target_scripts_found = [];
461 5 my $target_pms_found = [];
462  
463 # BULK88 20150608 2015.159: Win32 Bug Fix
464 #foreach my $inc_path ( $directories_loaded, @INC ) { # this doesn't work with Win32
465 # DEV NOTE: search order precedence for script command is OS paths, path of loaded TARGET/Config.pm (this file), Perl INC paths
466 5 foreach my $inc_path ( ( split ':', $ENV{PATH} ), File::Spec->catpath( $volume_loaded, $directories_loaded, '' ), @INC ) {
467  
468 # print {*STDERR} 'in ' . $target_package_name_config . ', top of main foreach() loop, have $inc_path = ', $inc_path, "\n";
469 95 my $sub_inc_paths = [];
470  
471 # push @{$sub_inc_paths}, $inc_path;
472 95 ( my $inc_volume, my $inc_directories, my $inc_file ) = File::Spec->splitpath( $inc_path, my $no_file = 1 );
473  
474 95 push @{$sub_inc_paths}, $inc_directories;
475  
476 95 my @directories_split = File::Spec->splitdir($inc_directories);
477 95 pop @directories_split;
478 95 push @{$sub_inc_paths}, File::Spec->catdir(@directories_split);
479 95 pop @directories_split;
480 95 push @{$sub_inc_paths}, File::Spec->catdir(@directories_split);
481  
482 # print {*STDERR} 'in ' . $target_package_name_config . ', in main foreach() loop, have $sub_inc_paths = ', "\n", Dumper($sub_inc_paths), "\n";
483 # print {*STDERR} 'in ' . $target_package_name_config . ', in main foreach() loop, have $inc_volume = ', "\n", Dumper($inc_volume), "\n";
484 # print {*STDERR} 'in ' . $target_package_name_config . ', in main foreach() loop, have $inc_directories = ', "\n", Dumper($inc_directories), "\n";
485 # print {*STDERR} 'in ' . $target_package_name_config . ', in main foreach() loop, have $inc_file = ', "\n", Dumper($inc_file), "\n";
486  
487 95 my $possible_target_scripts = [];
488 95 foreach my $sub_inc_path ( @{$sub_inc_paths} ) {
489 285 push @{$possible_target_scripts}, File::Spec->catpath( $inc_volume, $sub_inc_path, $target_file_name_script );
490 285 ▶ if ( $sub_inc_path ne q{} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sub_inc_path ne '') { } 265 20 285
491 265 push @{$possible_target_scripts}, File::Spec->catpath( $inc_volume, File::Spec->catdir( $sub_inc_path, 'script' ), $target_file_name_script );
492 265 push @{$possible_target_scripts}, File::Spec->catpath( $inc_volume, File::Spec->catdir( $sub_inc_path, 'bin' ), $target_file_name_script );
493 }
494 else {
495 20 push @{$possible_target_scripts}, File::Spec->catpath( $inc_volume, 'script', $target_file_name_script );
496 20 push @{$possible_target_scripts}, File::Spec->catpath( $inc_volume, 'bin', $target_file_name_script );
497 }
498 }
499  
500 95 foreach my $possible_target_script ( @{$possible_target_scripts} ) {
501  
502 # print {*STDERR} 'in ' . $target_package_name_config . ', have $possible_target_script = ', $possible_target_script, "\n";
503 # BULK88 20150608 2015.159: Win32 Bug Fix
504 # if ( ( -e $possible_target_script ) and ( -x $possible_target_script ) ) {
505 855 ▶ if ( ( -f $possible_target_script ) and ( $OSNAME eq 'MSWin32' ? 1 : -x $possible_target_script ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f $possible_target_script and $Perl::OSNAME eq "MSWin32" ? 1 : -x $possible_target_script) 95 760 855
$Perl::OSNAME eq 'MSWin32' ? : 0 95 95
Condition66%2/3
-f $possible_target_script and $Perl::OSNAME eq "MSWin32" ? 1 : -x $possible_target_script
!ll&&!rl&&r
760095
MC/DC50%1/2
-f $possible_target_script and $Perl::OSNAME eq "MSWin32" ? 1 : -x $possible_target_script
-f $possible_target_script $Perl::OSNAME eq "MSWin32" ? 1 : -x $possible_target_script
Truth table66%2/3
A and B
A= -f $possible_target_scriptB= $Perl::OSNAME eq "MSWin32" ? 1 : -x $possible_target_script
ABresult
0X0
100
111
506 95 my $is_unique = 1;
507 95 foreach my $target_script_found ( @{$target_scripts_found} ) {
508 230 ▶ if ( $target_script_found eq $possible_target_script ) { $is_unique = 0; }
Branch: 1 branch
BranchTrueFalseTotal
if ($target_script_found eq $possible_target_script) 80 150 230
509 }
510 95 ▶ if ($is_unique) { push @{$target_scripts_found}, $possible_target_script; }
Branch: 1 branch
BranchTrueFalseTotal
if ($is_unique) 15 80 95
511 }
512 }
513  
514 95 ▶ if ( not defined $target_pm_loaded ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $target_pm_loaded) 95 0 95
515 95 my $possible_target_pm = File::Spec->catfile( $inc_path, $target_file_name_pm );
516  
517 # BULK88 20150608 2015.159: Win32 Bug Fix
518 # if ( -e $possible_target_pm ) {
519 95 ▶ if ( -f $possible_target_pm ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $possible_target_pm) 15 80 95
520 15 my $is_unique = 1;
521 15 foreach my $target_pm_found ( @{$target_pms_found} ) {
522 10 ▶ if ( $target_pm_found eq $possible_target_pm ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target_pm_found eq $possible_target_pm) 5 5 10
523 5 $is_unique = 0;
524 }
525 }
526 15 ▶ if ($is_unique) { push @{$target_pms_found}, $possible_target_pm; }
Branch: 1 branch
BranchTrueFalseTotal
if ($is_unique) 10 5 15
527 }
528 }
529 }
530  
531 #print {*STDERR} 'in ' . $target_package_name_config . ', have $target_scripts_found = ', "\n", Dumper($target_scripts_found), "\n";
532 #print {*STDERR} 'in ' . $target_package_name_config . ', have $target_pms_found = ', "\n", Dumper($target_pms_found), "\n";
533  
534 5 ▶ if ( scalar @{$target_scripts_found} == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @{$target_scripts_found;} == 0) 0 5 5
535 0 die 'ERROR EEXRP00: Failed to find `' . $target_file_name_script . '` executable, dying' . "\n";
536 }
537 5 my $target_script_found = $target_scripts_found->[0];
538 5 ▶ if ( scalar @{$target_scripts_found} > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @{$target_scripts_found;} > 1) 5 0 5
539 Perl::warning( 'WARNING WEXRP00: Found multiple `' . $target_file_name_script . '` executables, using first located, ' .
540 q{`} . $target_script_found . q{`} . '; other locations include ' .
541 5 (join ', ', (map {q{`} . $_ . q{`}} @{$target_scripts_found}[1 .. ((scalar @{$target_scripts_found} - 1))])) . "\n" );
542 }
543  
544 5 my $target_pm_found = undef;
545 5 ▶ if ( defined $target_pm_loaded ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $target_pm_loaded) { } 0 5 5
546 0 $target_pm_found = $target_pm_loaded;
547 }
548 else {
549  
550 5 ▶ if ( scalar @{$target_pms_found} == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @{$target_pms_found;} == 0) 0 5 5
551 0 die 'ERROR EINRP00: Failed to find ' . $target_file_name_pm . ' module, croaking';
552 # Carp::croak 'ERROR EINRP00: Failed to find ' . $target_file_name_pm . ' module, croaking';
553 }
554 5 foreach my $target_pm_found_single ( @{$target_pms_found} ) {
555 # strip leading './' and '.\', for matching purposes only, do not actually save stripped filename
556 10 my $target_pm_found_single_stripped = $target_pm_found_single;
557 10 ▶ if (((substr $target_pm_found_single, 0, 2) eq './') or ((substr $target_pm_found_single, 0, 2) eq '.\\')) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($target_pm_found_single, 0, 2) eq "./" or substr($target_pm_found_single, 0, 2) eq ".\\") 0 10 10
Condition33%1/3
substr($target_pm_found_single, 0, 2) eq "./" or substr($target_pm_found_single, 0, 2) eq ".\\"
l!l&&r!l&&!r
0010
MC/DC0%0/2
substr($target_pm_found_single, 0, 2) eq "./" or substr($target_pm_found_single, 0, 2) eq ".\\"
substr($target_pm_found_single, 0, 2) eq "./" substr($target_pm_found_single, 0, 2) eq ".\\"
Truth table33%1/3
A or B
A= substr($target_pm_found_single, 0, 2) eq "./"B= substr($target_pm_found_single, 0, 2) eq ".\\"
ABresult
1X1
011
000
558 0 substr $target_pm_found_single_stripped, 0, 2, q{};
559 }
560 10 ▶ if ( $target_pm_found_single_stripped eq $target_pm_wanted ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($target_pm_found_single_stripped eq $target_pm_wanted) 5 5 10
561 5 $target_pm_found = $target_pm_found_single;
562 }
563 }
564 5 ▶ if ( not defined $target_pm_found ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $target_pm_found) 0 5 5
565 0 Carp::croak 'ERROR EINRP01: Expected to find ', $target_pm_wanted, ' but instead found ', "\n", Dumper($target_pms_found), ', croaking';
566 }
567 }
568  
569 #print {*STDERR} 'in ' . $target_package_name_config . ', have $target_pm_found = ', $target_pm_found, "\n";
570 #print {*STDERR} 'in ' . $target_package_name_config . ', have $target_script_found = ', $target_script_found, "\n";
571  
572 #( my $volume_target_pm, my $directories_target_pm, my $file_target_pm ) = File::Spec->splitpath( $target_pm_found, $no_file = 0 );
573 #( my $volume_target_script, my $directories_target_script, my $file_target_script ) = File::Spec->splitpath( $target_script_found, $no_file = 0 );
574 5 ( undef, my $directories_target_pm, my $file_target_pm ) = File::Spec->splitpath( $target_pm_found, $no_file = 0 );
575 5 ( undef, my $directories_target_script, my $file_target_script ) = File::Spec->splitpath( $target_script_found, $no_file = 0 );
576  
577 #print {*STDERR} 'in ' . $target_package_name_config . ', have $volume_target_pm = ', $volume_target_pm, "\n";
578 #print {*STDERR} 'in ' . $target_package_name_config . ', have $directories_target_pm = ', $directories_target_pm, "\n";
579 #print {*STDERR} 'in ' . $target_package_name_config . ', have $file_target_pm = ', $file_target_pm, "\n";
580 #print {*STDERR} 'in ' . $target_package_name_config . ', have $volume_target_script = ', $volume_target_script, "\n";
581 #print {*STDERR} 'in ' . $target_package_name_config . ', have $directories_target_script = ', $directories_target_script, "\n";
582 #print {*STDERR} 'in ' . $target_package_name_config . ', have $file_target_script = ', $file_target_script, "\n";
583  
584 5 my @directories_target_pm_split = File::Spec->splitdir($directories_target_pm);
585 5 my @directories_target_script_split = File::Spec->splitdir($directories_target_script);
586 5 my @directories_base_split = ();
587  
588 5 for my $i ( 0 .. ( ( scalar @directories_target_pm_split ) - 1 ) ) {
589 10 ▶ if ( $directories_target_pm_split[$i] eq $directories_target_script_split[$i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($directories_target_pm_split[$i] eq $directories_target_script_split[$i]) { } 5 5 10
590 5 push @directories_base_split, $directories_target_pm_split[$i];
591 }
592 else {
593 5 for my $j ( 0 .. ( $i - 1 ) ) {
594 5 shift @directories_target_pm_split;
595 5 shift @directories_target_script_split;
596 }
597 5 last;
598 }
599 }
600  
601 #print {*STDERR} 'in ' . $target_package_name_config . ', have @directories_base_split = ', "\n", Dumper(\@directories_base_split), "\n";
602 #print {*STDERR} 'in ' . $target_package_name_config . ', have @directories_target_pm_split = ', "\n", Dumper(\@directories_target_pm_split), "\n";
603 #print {*STDERR} 'in ' . $target_package_name_config . ', have @directories_target_script_split = ', "\n", Dumper(\@directories_target_script_split), "\n";
604  
605 5 my $MY_BASE_PATH;
606 my $MY_INCLUDE_PATH;
607 5 my $MY_SCRIPT_PATH;
608 5 my $MY_CORE_PATH;
609  
610 # NEED FIX: how do we catpath() with some $volume instead of catdir() below, without breaking relative paths?
611 5 $MY_BASE_PATH = File::Spec->catpath( $volume_loaded, File::Spec->catdir(@directories_base_split), '' );
612 5 ▶ if ( $MY_BASE_PATH eq q{} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($MY_BASE_PATH eq '') { } 0 5 5
613 0 $MY_INCLUDE_PATH = File::Spec->catpath( $volume_loaded, File::Spec->catdir(@directories_target_pm_split), '' );
614 0 $MY_SCRIPT_PATH = File::Spec->catpath( $volume_loaded, File::Spec->catdir(@directories_target_script_split), '' );
615 #print {*STDERR} 'in ' . $target_package_name_config . ', have $MY_BASE_PATH eq q{} = ', $MY_BASE_PATH, "\n";
616 }
617 else {
618 5 $MY_INCLUDE_PATH = File::Spec->catdir( $MY_BASE_PATH, @directories_target_pm_split );
619 5 $MY_SCRIPT_PATH = File::Spec->catdir( $MY_BASE_PATH, @directories_target_script_split );
620 #print {*STDERR} 'in ' . $target_package_name_config . ', have $MY_BASE_PATH ne q{} ', $MY_BASE_PATH, "\n";
621 }
622  
623 5 foreach my $inc_path (@INC) {
624 30 $MY_CORE_PATH = File::Spec->catdir( $inc_path, 'CORE' );
625 30 my $inc_core_perl_h_path = File::Spec->catfile( $MY_CORE_PATH, 'perl.h' );
626 30 ▶ if ( ( -e $inc_core_perl_h_path ) and ( -r $inc_core_perl_h_path ) and ( -f $inc_core_perl_h_path ) ) { last; }
Branch: 1 branch
BranchTrueFalseTotal
if (-e $inc_core_perl_h_path and -r $inc_core_perl_h_path and -f $inc_core_perl_h_path) { } 5 25 30
Condition66%4/6
-e $inc_core_perl_h_path and -r $inc_core_perl_h_path and -f $inc_core_perl_h_path
!ll&&!rl&&r
2505
-e $inc_core_perl_h_path and -r $inc_core_perl_h_path
!ll&&!rl&&r
2505
MC/DC33%1/3
-e $inc_core_perl_h_path and -r $inc_core_perl_h_path and -f $inc_core_perl_h_path
-e $inc_core_perl_h_path -r $inc_core_perl_h_path -f $inc_core_perl_h_path
Truth table50%2/4
A and B and C
A= -e $inc_core_perl_h_pathB= -r $inc_core_perl_h_pathC= -f $inc_core_perl_h_path
ABCresult
0XX0
10X0
1100
1111
627 25 else { $MY_CORE_PATH = q{}; }
628 }
629  
630 #print {*STDERR} 'in ' . $target_package_name_config . ', have $MY_BASE_PATH = ', $MY_BASE_PATH, "\n";
631 #print {*STDERR} 'in ' . $target_package_name_config . ', have $MY_INCLUDE_PATH = ', $MY_INCLUDE_PATH, "\n";
632 #print {*STDERR} 'in ' . $target_package_name_config . ', have $MY_SCRIPT_PATH = ', $MY_SCRIPT_PATH, "\n";
633 #print {*STDERR} 'in ' . $target_package_name_config . ', have $MY_CORE_PATH = ', $MY_CORE_PATH, "\n";
634
635 5 return [$MY_BASE_PATH, $MY_INCLUDE_PATH, $MY_SCRIPT_PATH, $MY_CORE_PATH];
636 }
637  
638 # [[[ OPERATIONS SPECIAL ]]]
639  
640 5 my $file_name_config = 'Perl/Config.pm'; # this file name
641 5 my $package_name_config = 'Perl::Config'; # this file's primary package name
642 5 my $file_name_pm = 'Perl.pm';
643 5 my $file_name_script = 'perl';
644 5 ($BASE_PATH, $INCLUDE_PATH, $SCRIPT_PATH, $CORE_PATH) = @{set_system_paths($file_name_config, $package_name_config, $file_name_pm, $file_name_script)};
645  
646 5 1; # end of package
647  
648  
649 # [[[ ADDITIONAL PACKAGES SPECIAL ]]]
650 # export system paths to main:: namespace for use by PMC files
651 package main;
652  
653 # [[[ OO CLASS PROPERTIES SPECIAL ]]]
654 # DEV NOTE: duplicate lines to avoid 'used only once' warnings
655 5 our $BASE_PATH = $Perl::BASE_PATH;
656 5 $BASE_PATH = $Perl::BASE_PATH;
657 5 our $INCLUDE_PATH = $Perl::INCLUDE_PATH;
658 5 $INCLUDE_PATH = $Perl::INCLUDE_PATH;
659 5 our $SCRIPT_PATH = $Perl::SCRIPT_PATH;
660 5 $SCRIPT_PATH = $Perl::SCRIPT_PATH;
661  
662 5 1; # end of package
« blib/lib/Perl/Type/GMPInteger.pm ↑ Summary blib/lib/Perl/Structure/Hash/SubTypes2D.pm »