| 1 | package Module::ScanDeps; | ||||||||||||||||||||||||||||||||
| 2 | 19 | ▶ | use 5.008001; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 3 | 19 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 19 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 19 | ▶ | use vars qw( $VERSION @EXPORT @EXPORT_OK @ISA $CurrentPackage @IncludeLibs $ScanFileRE ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 19 | $VERSION = '1.37'; | |||||||||||||||||||||||||||||||
| 8 | 19 | @EXPORT = qw( scan_deps scan_deps_runtime ); | |||||||||||||||||||||||||||||||
| 9 | 19 | @EXPORT_OK = qw( scan_line scan_chunk add_deps scan_deps_runtime path_to_inc_name ); | |||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | 19 | ▶ | use Config; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 19 | require Exporter; | |||||||||||||||||||||||||||||||
| 13 | 19 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 19 | ▶ | use version; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 19 | ▶ | use File::Path (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | 19 | ▶ | use File::Temp (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 18 | 19 | ▶ | use FileHandle; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | 19 | ▶ | use Module::Metadata; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 20 | 19 | ▶ | use List::Util qw ( any first ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | # NOTE: Keep the following imports exactly as specified, even if the Module::ScanDeps source | ||||||||||||||||||||||||||||||||
| 23 | # doesn't reference some of them. See '"use lib" idioms' for the reason. | ||||||||||||||||||||||||||||||||
| 24 | 19 | ▶ | use Cwd (qw(abs_path)); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 25 | 19 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 26 | 19 | ▶ | use File::Spec::Functions; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 27 | 19 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | 19 | ▶ | use constant is_insensitive_fs => File::Spec->case_tolerant(); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 19 | $ScanFileRE = qr/(?:^|\\|\/)(?:[^.]*|.*\.(?i:p[ml]|t|al))$/; | |||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 19 | my %_glob_cache; | |||||||||||||||||||||||||||||||
| 34 | my %_file_cache; | ||||||||||||||||||||||||||||||||
| 35 | 19 | my $_cached_inc = ""; | |||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | Module::ScanDeps - Recursively scan Perl code for dependencies | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | Via the command-line program L<scandeps.pl>: | ||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | % scandeps.pl *.pm # Print PREREQ_PM section for *.pm | ||||||||||||||||||||||||||||||||
| 46 | % scandeps.pl -e "use utf8" # Read script from command line | ||||||||||||||||||||||||||||||||
| 47 | % scandeps.pl -B *.pm # Include core modules | ||||||||||||||||||||||||||||||||
| 48 | % scandeps.pl -V *.pm # Show autoload/shared/data files | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | Used in a program; | ||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | use Module::ScanDeps; | ||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | # standard usage | ||||||||||||||||||||||||||||||||
| 55 | my $hash_ref = scan_deps( | ||||||||||||||||||||||||||||||||
| 56 | files => [ 'a.pl', 'b.pl' ], | ||||||||||||||||||||||||||||||||
| 57 | recurse => 1, | ||||||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | # shorthand; assume recurse == 1 | ||||||||||||||||||||||||||||||||
| 61 | my $hash_ref = scan_deps( 'a.pl', 'b.pl' ); | ||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | # App::Packer::Frontend compatible interface | ||||||||||||||||||||||||||||||||
| 64 | # see App::Packer::Frontend for the structure returned by get_files | ||||||||||||||||||||||||||||||||
| 65 | my $scan = Module::ScanDeps->new; | ||||||||||||||||||||||||||||||||
| 66 | $scan->set_file( 'a.pl' ); | ||||||||||||||||||||||||||||||||
| 67 | $scan->set_options( add_modules => [ 'Test::More' ] ); | ||||||||||||||||||||||||||||||||
| 68 | $scan->calculate_info; | ||||||||||||||||||||||||||||||||
| 69 | my $files = $scan->get_files; | ||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||
| 71 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||
| 73 | This module scans potential modules used by perl programs, and returns a | ||||||||||||||||||||||||||||||||
| 74 | hash reference; its keys are the module names as appears in C<%INC> | ||||||||||||||||||||||||||||||||
| 75 | (e.g. C<Test/More.pm>); the values are hash references with this structure: | ||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||
| 77 | { | ||||||||||||||||||||||||||||||||
| 78 | file => '/usr/local/lib/perl5/5.8.0/Test/More.pm', | ||||||||||||||||||||||||||||||||
| 79 | key => 'Test/More.pm', | ||||||||||||||||||||||||||||||||
| 80 | type => 'module', # or 'autoload', 'data', 'shared' | ||||||||||||||||||||||||||||||||
| 81 | used_by => [ 'Test/Simple.pm', ... ], | ||||||||||||||||||||||||||||||||
| 82 | uses => [ 'Test/Other.pm', ... ], | ||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | One function, C<scan_deps>, is exported by default. Other | ||||||||||||||||||||||||||||||||
| 86 | functions such as (C<scan_line>, C<scan_chunk>, C<add_deps>, C<path_to_inc_name>) | ||||||||||||||||||||||||||||||||
| 87 | are exported upon request. | ||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | Users of B<App::Packer> may also use this module as the dependency-checking | ||||||||||||||||||||||||||||||||
| 90 | frontend, by tweaking their F<p2e.pl> like below: | ||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||
| 92 | use Module::ScanDeps; | ||||||||||||||||||||||||||||||||
| 93 | ... | ||||||||||||||||||||||||||||||||
| 94 | my $packer = App::Packer->new( frontend => 'Module::ScanDeps' ); | ||||||||||||||||||||||||||||||||
| 95 | ... | ||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||
| 97 | Please see L<App::Packer::Frontend> for detailed explanation on | ||||||||||||||||||||||||||||||||
| 98 | the structure returned by C<get_files>. | ||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||
| 100 | =head2 B<scan_deps> | ||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | $rv_ref = scan_deps( | ||||||||||||||||||||||||||||||||
| 103 | files => \@files, recurse => $recurse, | ||||||||||||||||||||||||||||||||
| 104 | rv => \%rv, skip => \%skip, | ||||||||||||||||||||||||||||||||
| 105 | compile => $compile, execute => $execute, | ||||||||||||||||||||||||||||||||
| 106 | ); | ||||||||||||||||||||||||||||||||
| 107 | $rv_ref = scan_deps(@files); # shorthand, with recurse => 1 | ||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||
| 109 | This function scans each file in C<@files>, registering their | ||||||||||||||||||||||||||||||||
| 110 | dependencies into C<%rv>, and returns a reference to the updated | ||||||||||||||||||||||||||||||||
| 111 | C<%rv>. The meaning of keys and values are explained above. | ||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | If C<$recurse> is true, C<scan_deps> will call itself recursively, | ||||||||||||||||||||||||||||||||
| 114 | to perform a breadth-first search on text files (as defined by the | ||||||||||||||||||||||||||||||||
| 115 | -T operator) found in C<%rv>. | ||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||
| 117 | If the C<\%skip> is specified, files that exists as its keys are | ||||||||||||||||||||||||||||||||
| 118 | skipped. This is used internally to avoid infinite recursion. | ||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | If C<$compile> or C<$execute> is true, runs C<files> in either | ||||||||||||||||||||||||||||||||
| 121 | compile-only or normal mode, then inspects their C<%INC> after | ||||||||||||||||||||||||||||||||
| 122 | termination to determine additional runtime dependencies. | ||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||
| 124 | If C<$execute> is an array reference, passes C<@$execute> | ||||||||||||||||||||||||||||||||
| 125 | as arguments to each file in C<@files> when it is run. | ||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||
| 127 | If performance of the scanning process is a concern, C<cache_file> can be | ||||||||||||||||||||||||||||||||
| 128 | set to a filename. The scanning results will be cached and written to the | ||||||||||||||||||||||||||||||||
| 129 | file. This will speed up the scanning process on subsequent runs. | ||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||
| 131 | Additionally, an option C<warn_missing> is recognized. If set to true, | ||||||||||||||||||||||||||||||||
| 132 | C<scan_deps> issues a warning to STDERR for every module file that the | ||||||||||||||||||||||||||||||||
| 133 | scanned code depends but that wasn't found. Please note that this may | ||||||||||||||||||||||||||||||||
| 134 | also report numerous false positives. That is why by default, the heuristic | ||||||||||||||||||||||||||||||||
| 135 | silently drops all dependencies it cannot find. | ||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||
| 137 | =head2 B<scan_deps_runtime> | ||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||
| 139 | Like B<scan_deps>, but skips the static scanning part. | ||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||
| 141 | =head2 B<scan_line> | ||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||
| 143 | @modules = scan_line($line); | ||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||
| 145 | Splits a line into chunks (currently with the semicolon characters), and | ||||||||||||||||||||||||||||||||
| 146 | return the union of C<scan_chunk> calls of them. | ||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||
| 148 | If the line is C<__END__> or C<__DATA__>, a single C<__END__> element is | ||||||||||||||||||||||||||||||||
| 149 | returned to signify the end of the program. | ||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||
| 151 | Similarly, it returns a single C<__POD__> if the line matches C</^=\w/>; | ||||||||||||||||||||||||||||||||
| 152 | the caller is responsible for skipping appropriate number of lines | ||||||||||||||||||||||||||||||||
| 153 | until C<=cut>, before calling C<scan_line> again. | ||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||
| 155 | =head2 B<scan_chunk> | ||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||
| 157 | $module = scan_chunk($chunk); | ||||||||||||||||||||||||||||||||
| 158 | @modules = scan_chunk($chunk); | ||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||
| 160 | Apply various heuristics to C<$chunk> to find and return the module | ||||||||||||||||||||||||||||||||
| 161 | name(s) it contains. In scalar context, returns only the first module | ||||||||||||||||||||||||||||||||
| 162 | or C<undef>. | ||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||
| 164 | =head2 B<add_deps> | ||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||
| 166 | $rv_ref = add_deps( rv => \%rv, modules => \@modules ); | ||||||||||||||||||||||||||||||||
| 167 | $rv_ref = add_deps( @modules ); # shorthand, without rv | ||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||
| 169 | Resolves a list of module names to its actual on-disk location, by | ||||||||||||||||||||||||||||||||
| 170 | finding in C<@INC> and C<@Module::ScanDeps::IncludeLibs>; | ||||||||||||||||||||||||||||||||
| 171 | modules that cannot be found are skipped. | ||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||
| 173 | This function populates the C<%rv> hash with module/filename pairs, and | ||||||||||||||||||||||||||||||||
| 174 | returns a reference to it. | ||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||
| 176 | =head2 B<path_to_inc_name> | ||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||
| 178 | $perl_name = path_to_inc_name($path, $warn) | ||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||
| 180 | Assumes C<$path> refers to a perl file and does it's best to return the | ||||||||||||||||||||||||||||||||
| 181 | name as it would appear in %INC. Returns undef if no match was found | ||||||||||||||||||||||||||||||||
| 182 | and a prints a warning to STDERR if C<$warn> is true. | ||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||
| 184 | E.g. if C<$path> = perl/site/lib/Module/ScanDeps.pm then C<$perl_name> | ||||||||||||||||||||||||||||||||
| 185 | will be Module/ScanDeps.pm. | ||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||
| 187 | =head1 NOTES | ||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||
| 189 | =head2 B<@Module::ScanDeps::IncludeLibs> | ||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||
| 191 | You can set this global variable to specify additional directories in | ||||||||||||||||||||||||||||||||
| 192 | which to search modules without modifying C<@INC> itself. | ||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||
| 194 | =head2 B<$Module::ScanDeps::ScanFileRE> | ||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||
| 196 | You can set this global variable to specify a regular expression to | ||||||||||||||||||||||||||||||||
| 197 | identify what files to scan. By default it includes all files of | ||||||||||||||||||||||||||||||||
| 198 | the following types: .pm, .pl, .t and .al. Additionally, all files | ||||||||||||||||||||||||||||||||
| 199 | without a suffix are considered. | ||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||
| 201 | For instance, if you want to scan all files then use the following: | ||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||
| 203 | C<$Module::ScanDeps::ScanFileRE = qr/./> | ||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||
| 205 | =head1 CAVEATS | ||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | This module intentionally ignores the B<BSDPAN> hack on FreeBSD -- the | ||||||||||||||||||||||||||||||||
| 208 | additional directory is removed from C<@INC> altogether. | ||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||
| 210 | The static-scanning heuristic is not likely to be 100% accurate, especially | ||||||||||||||||||||||||||||||||
| 211 | on modules that dynamically load other modules. | ||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||
| 213 | Chunks that span multiple lines are not handled correctly. For example, | ||||||||||||||||||||||||||||||||
| 214 | this one works: | ||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||
| 216 | use base 'Foo::Bar'; | ||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||
| 218 | But this one does not: | ||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||
| 220 | use base | ||||||||||||||||||||||||||||||||
| 221 | 'Foo::Bar'; | ||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||
| 223 | =cut | ||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||
| 225 | 19 | my $SeenTk; | |||||||||||||||||||||||||||||||
| 226 | my %SeenRuntimeLoader; | ||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||
| 228 | # match "use LOADER LIST" chunks; sets $1 to LOADER and $2 to LIST | ||||||||||||||||||||||||||||||||
| 229 | 19 | my $LoaderRE = | |||||||||||||||||||||||||||||||
| 230 | qr/^ use \s+ | ||||||||||||||||||||||||||||||||
| 231 | ( asa | ||||||||||||||||||||||||||||||||
| 232 | | base | ||||||||||||||||||||||||||||||||
| 233 | | parent | ||||||||||||||||||||||||||||||||
| 234 | | prefork | ||||||||||||||||||||||||||||||||
| 235 | | POE | ||||||||||||||||||||||||||||||||
| 236 | | encoding | ||||||||||||||||||||||||||||||||
| 237 | | maybe | ||||||||||||||||||||||||||||||||
| 238 | | only::matching | ||||||||||||||||||||||||||||||||
| 239 | | Mojo::Base | ||||||||||||||||||||||||||||||||
| 240 | | Catalyst | ||||||||||||||||||||||||||||||||
| 241 | )(?!\:) \b \s* (.*) | ||||||||||||||||||||||||||||||||
| 242 | /sx; | ||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||
| 244 | # Pre-loaded module dependencies {{{ | ||||||||||||||||||||||||||||||||
| 245 | my %Preload = ( | ||||||||||||||||||||||||||||||||
| 246 | 'AnyDBM_File.pm' => [qw( SDBM_File.pm )], | ||||||||||||||||||||||||||||||||
| 247 | 'AnyEvent.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 248 | 'Authen/SASL.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||
| 250 | 'B/Hooks/EndOfScope.pm' => | ||||||||||||||||||||||||||||||||
| 251 | [qw( B/Hooks/EndOfScope/PP.pm B/Hooks/EndOfScope/XS.pm )], | ||||||||||||||||||||||||||||||||
| 252 | 'Bio/AlignIO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 253 | 'Bio/Assembly/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 254 | 'Bio/Biblio/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 255 | 'Bio/ClusterIO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 256 | 'Bio/CodonUsage/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 257 | 'Bio/DB/Biblio.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 258 | 'Bio/DB/Flat.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 259 | 'Bio/DB/GFF.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 260 | 'Bio/DB/Taxonomy.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 261 | 'Bio/Graphics/Glyph.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 262 | 'Bio/MapIO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 263 | 'Bio/Matrix/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 264 | 'Bio/Matrix/PSM/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 265 | 'Bio/OntologyIO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 266 | 'Bio/PopGen/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 267 | 'Bio/Restriction/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 268 | 'Bio/Root/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 269 | 'Bio/SearchIO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 270 | 'Bio/SeqIO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 271 | 'Bio/Structure/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 272 | 'Bio/TreeIO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 273 | 'Bio/LiveSeq/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 274 | 'Bio/Variation/IO.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | 'Catalyst.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 277 | 0 | return ('Catalyst/Runtime.pm', | |||||||||||||||||||||||||||||||
| 278 | 'Catalyst/Dispatcher.pm', | ||||||||||||||||||||||||||||||||
| 279 | _glob_in_inc('Catalyst/DispatchType', 1)); | ||||||||||||||||||||||||||||||||
| 280 | }, | ||||||||||||||||||||||||||||||||
| 281 | 'Catalyst/Engine.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 282 | 'CGI/Application/Plugin/Authentication.pm' => | ||||||||||||||||||||||||||||||||
| 283 | [qw( CGI/Application/Plugin/Authentication/Store/Cookie.pm )], | ||||||||||||||||||||||||||||||||
| 284 | 'CGI/Application/Plugin/AutoRunmode.pm' => [qw( Attribute/Handlers.pm )], | ||||||||||||||||||||||||||||||||
| 285 | 'charnames.pm' => \&_unicore, | ||||||||||||||||||||||||||||||||
| 286 | 'Class/Load.pm' => [qw( Class/Load/PP.pm )], | ||||||||||||||||||||||||||||||||
| 287 | 'Class/MakeMethods.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 288 | 'Class/MethodMaker.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 289 | 'Class/Plain.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 290 | 'Config/Any.pm' =>'sub', | ||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | 'Crypt/Random.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 292 | 0 | _glob_in_inc('Crypt/Random/Provider', 1); | |||||||||||||||||||||||||||||||
| 293 | }, | ||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | 'Crypt/Random/Generator.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 295 | 0 | _glob_in_inc('Crypt/Random/Provider', 1); | |||||||||||||||||||||||||||||||
| 296 | }, | ||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||
| 298 | 'Date/Manip.pm' => | ||||||||||||||||||||||||||||||||
| 299 | [qw( Date/Manip/DM5.pm Date/Manip/DM6.pm )], | ||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | 'Date/Manip/Base.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 301 | 0 | _glob_in_inc('Date/Manip/Lang', 1); | |||||||||||||||||||||||||||||||
| 302 | }, | ||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | 'Date/Manip/TZ.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 304 | 0 | return (_glob_in_inc('Date/Manip/TZ', 1), | |||||||||||||||||||||||||||||||
| 305 | _glob_in_inc('Date/Manip/Offset', 1)); | ||||||||||||||||||||||||||||||||
| 306 | }, | ||||||||||||||||||||||||||||||||
| 307 | 'DateTime/Format/Builder/Parser.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 308 | 'DateTime/Format/Natural.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 309 | 'DateTime/Locale.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 310 | 'DateTime/TimeZone.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | 'DBI.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 312 | 0 | grep !/\bProxy\b/, _glob_in_inc('DBD', 1); | |||||||||||||||||||||||||||||||
| 313 | }, | ||||||||||||||||||||||||||||||||
| 314 | 'DBIx/Class.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 315 | 'DBIx/SearchBuilder.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 316 | 'DBIx/Perlish.pm' => [qw( attributes.pm )], | ||||||||||||||||||||||||||||||||
| 317 | 'DBIx/ReportBuilder.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 318 | 'Device/ParallelPort.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 319 | 'Device/SerialPort.pm' => | ||||||||||||||||||||||||||||||||
| 320 | [qw( termios.ph asm/termios.ph sys/termiox.ph sys/termios.ph sys/ttycom.ph )], | ||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | 'diagnostics.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=33.1
| |||||||||||||||||||||||||||||||||
| 322 | # shamelessly taken and adapted from diagnostics.pm | ||||||||||||||||||||||||||||||||
| 323 | 19 | ▶ | use Config; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 324 | 0 | my($privlib, $archlib) = @Config{qw(privlibexp archlibexp)}; | |||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | if ($^O eq 'VMS') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 326 | 0 | require VMS::Filespec; | |||||||||||||||||||||||||||||||
| 327 | 0 | $privlib = VMS::Filespec::unixify($privlib); | |||||||||||||||||||||||||||||||
| 328 | 0 | $archlib = VMS::Filespec::unixify($archlib); | |||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||
| 331 | 0 | for ( | |||||||||||||||||||||||||||||||
| 332 | "pod/perldiag.pod", | ||||||||||||||||||||||||||||||||
| 333 | "Pod/perldiag.pod", | ||||||||||||||||||||||||||||||||
| 334 | "pod/perldiag-$Config{version}.pod", | ||||||||||||||||||||||||||||||||
| 335 | "Pod/perldiag-$Config{version}.pod", | ||||||||||||||||||||||||||||||||
| 336 | "pods/perldiag.pod", | ||||||||||||||||||||||||||||||||
| 337 | "pods/perldiag-$Config{version}.pod", | ||||||||||||||||||||||||||||||||
| 338 | ) { | ||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | return $_ if _find_in_inc($_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||
| 342 | 0 | for ( | |||||||||||||||||||||||||||||||
| 343 | "$archlib/pods/perldiag.pod", | ||||||||||||||||||||||||||||||||
| 344 | "$privlib/pods/perldiag-$Config{version}.pod", | ||||||||||||||||||||||||||||||||
| 345 | "$privlib/pods/perldiag.pod", | ||||||||||||||||||||||||||||||||
| 346 | ) { | ||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | return $_ if -f $_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||
| 350 | 0 | return 'pod/perldiag.pod'; | |||||||||||||||||||||||||||||||
| 351 | }, | ||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||
| 353 | 'Email/Send.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 354 | 1 | ▶ | 'Event.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 355 | 1 | map "Event/$_.pm", qw( idle io signal timer var ); | |||||||||||||||||||||||||||||||
| 356 | }, | ||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | 'ExtUtils/MakeMaker.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 358 | 0 | grep /\bMM_/, _glob_in_inc('ExtUtils', 1); | |||||||||||||||||||||||||||||||
| 359 | }, | ||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||
| 361 | 'FFI/Platypus.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 362 | 'File/Basename.pm' => [qw( re.pm )], | ||||||||||||||||||||||||||||||||
| 363 | 'File/BOM.pm' => [qw( Encode/Unicode.pm )], | ||||||||||||||||||||||||||||||||
| 364 | 'File/HomeDir.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 365 | 21 | ▶ | 'File/Spec.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 366 | 21 | require File::Spec; | |||||||||||||||||||||||||||||||
| 367 | 21 | map { my $name = $_; $name =~ s!::!/!g; "$name.pm" } @File::Spec::ISA; | |||||||||||||||||||||||||||||||
| 368 | }, | ||||||||||||||||||||||||||||||||
| 369 | 'Future/AsyncAwait.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 370 | 'Future/AsyncAwait/Hooks.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||
| 372 | 'Gtk2.pm' => [qw( Cairo.pm )], # Gtk2.pm does: eval "use Cairo;" | ||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||
| 374 | 'HTTP/Entity/Parser.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 375 | 'HTTP/Message.pm' => [qw( URI/URL.pm URI.pm )], | ||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | 'Image/ExifTool.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 378 | return( | ||||||||||||||||||||||||||||||||
| 379 | 0 | (map $_->{name}, _glob_in_inc('Image/ExifTool', 0)), # also *.pl files | |||||||||||||||||||||||||||||||
| 380 | qw( File/RandomAccess.pm ), | ||||||||||||||||||||||||||||||||
| 381 | ); | ||||||||||||||||||||||||||||||||
| 382 | }, | ||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | 'Image/Info.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 384 | return( | ||||||||||||||||||||||||||||||||
| 385 | 0 | _glob_in_inc('Image/Info', 1), | |||||||||||||||||||||||||||||||
| 386 | qw( Image/TIFF.pm ), | ||||||||||||||||||||||||||||||||
| 387 | ); | ||||||||||||||||||||||||||||||||
| 388 | }, | ||||||||||||||||||||||||||||||||
| 389 | 'IO.pm' => [qw( | ||||||||||||||||||||||||||||||||
| 390 | IO/Handle.pm IO/Seekable.pm IO/File.pm | ||||||||||||||||||||||||||||||||
| 391 | IO/Pipe.pm IO/Socket.pm IO/Dir.pm | ||||||||||||||||||||||||||||||||
| 392 | )], | ||||||||||||||||||||||||||||||||
| 393 | 'IO/Socket.pm' => [qw( IO/Socket/UNIX.pm )], | ||||||||||||||||||||||||||||||||
| 394 | 'IUP.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | 'JSON.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 397 | # add JSON/PP*.pm, JSON/PP/*.pm | ||||||||||||||||||||||||||||||||
| 398 | # and ignore other JSON::* modules (e.g. JSON/Syck.pm, JSON/Any.pm); | ||||||||||||||||||||||||||||||||
| 399 | # but accept JSON::XS, too (because JSON.pm might use it if present) | ||||||||||||||||||||||||||||||||
| 400 | 0 | return( grep /^JSON\/(PP|XS)/, _glob_in_inc('JSON', 1) ); | |||||||||||||||||||||||||||||||
| 401 | }, | ||||||||||||||||||||||||||||||||
| 402 | 'JSON/MaybeXS.pm' => [qw( | ||||||||||||||||||||||||||||||||
| 403 | Cpanel/JSON/XS.pm JSON/XS.pm JSON/PP.pm | ||||||||||||||||||||||||||||||||
| 404 | )], | ||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||
| 406 | 'List/Keywords.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 407 | 'List/MoreUtils.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 408 | 'List/SomeUtils.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 409 | 'Locale/Maketext/Lexicon.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 410 | 'Locale/Maketext/GutsLoader.pm' => [qw( Locale/Maketext/Guts.pm )], | ||||||||||||||||||||||||||||||||
| 411 | 'Log/Any.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 412 | 'Log/Dispatch.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 413 | 'Log/Log4perl.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 414 | 'Log/Report/Dispatcher.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 415 | 'LWP/MediaTypes.pm' => [qw( LWP/media.types )], | ||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | 'LWP/Parallel.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 417 | 0 | _glob_in_inc( 'LWP/Parallel', 1 ), | |||||||||||||||||||||||||||||||
| 418 | qw( | ||||||||||||||||||||||||||||||||
| 419 | LWP/ParallelUA.pm LWP/UserAgent.pm | ||||||||||||||||||||||||||||||||
| 420 | LWP/RobotPUA.pm LWP/RobotUA.pm | ||||||||||||||||||||||||||||||||
| 421 | ), | ||||||||||||||||||||||||||||||||
| 422 | }, | ||||||||||||||||||||||||||||||||
| 423 | 'LWP/Parallel/UserAgent.pm' => [qw( LWP/Parallel.pm )], | ||||||||||||||||||||||||||||||||
| 424 | 2 | ▶ | 'LWP/UserAgent.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 425 | return( | ||||||||||||||||||||||||||||||||
| 426 | 2 | qw( URI/URL.pm URI/http.pm LWP/Protocol/http.pm ), | |||||||||||||||||||||||||||||||
| 427 | _glob_in_inc("LWP/Authen", 1), | ||||||||||||||||||||||||||||||||
| 428 | _glob_in_inc("LWP/Protocol", 1), | ||||||||||||||||||||||||||||||||
| 429 | ); | ||||||||||||||||||||||||||||||||
| 430 | }, | ||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||
| 432 | 'Mail/Audit.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 433 | 'Math/BigInt.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 434 | 'Math/BigFloat.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 435 | 'Math/Symbolic.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 436 | 'MIME/Decoder.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 437 | 'MIME/Types.pm' => [qw( MIME/types.db )], | ||||||||||||||||||||||||||||||||
| 438 | 'Module/Build.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 439 | 2 | ▶ | 'Module/Pluggable.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 440 | 2 | _glob_in_inc('$CurrentPackage/Plugin', 1); | |||||||||||||||||||||||||||||||
| 441 | }, | ||||||||||||||||||||||||||||||||
| 442 | 'Moo.pm' => [qw( Class/XSAccessor.pm )], | ||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | 'Moose.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 444 | 0 | _glob_in_inc('Moose', 1), | |||||||||||||||||||||||||||||||
| 445 | _glob_in_inc('Class/MOP', 1), | ||||||||||||||||||||||||||||||||
| 446 | }, | ||||||||||||||||||||||||||||||||
| 447 | 'MooseX/AttributeHelpers.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | 'MooseX/POE.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 449 | 0 | _glob_in_inc('MooseX/POE', 1), | |||||||||||||||||||||||||||||||
| 450 | _glob_in_inc('MooseX/Async', 1), | ||||||||||||||||||||||||||||||||
| 451 | }, | ||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | 'MooX/HandlesVia.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 453 | 0 | _glob_in_inc('Data/Perl', 1) | |||||||||||||||||||||||||||||||
| 454 | }, | ||||||||||||||||||||||||||||||||
| 455 | 'Mozilla/CA.pm' => [qw( Mozilla/CA/cacert.pem )], | ||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | 'MozRepl.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 457 | 0 | qw( MozRepl/Log.pm MozRepl/Client.pm Module/Pluggable/Fast.pm ), | |||||||||||||||||||||||||||||||
| 458 | _glob_in_inc('MozRepl/Plugin', 1), | ||||||||||||||||||||||||||||||||
| 459 | }, | ||||||||||||||||||||||||||||||||
| 460 | 'Module/Implementation.pm' => \&_warn_of_runtime_loader, | ||||||||||||||||||||||||||||||||
| 461 | 'Module/Runtime.pm' => \&_warn_of_runtime_loader, | ||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | 'Mojo/Util.pm' => sub { # html_entities.txt | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 463 | 0 | map { $_->{name} } _glob_in_inc('Mojo/resources', 0) | |||||||||||||||||||||||||||||||
| 464 | }, | ||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | 'Mojo/IOLoop/TLS.pm' => sub { # server.{crt,key} | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 466 | 0 | map { $_->{name} } _glob_in_inc('Mojo/IOLoop/resources', 0) | |||||||||||||||||||||||||||||||
| 467 | }, | ||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||
| 469 | 'Net/DNS/Resolver.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 470 | 'Net/DNS/RR.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 471 | 'Net/FTP.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 472 | 'Net/HTTPS.pm' => [qw( IO/Socket/SSL.pm Net/SSL.pm )], | ||||||||||||||||||||||||||||||||
| 473 | 'Net/Server.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 474 | 'Net/SSH/Perl.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||
| 476 | 'Object/Pad.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 477 | 'Object/Pad/Keyword/Accessor.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||
| 479 | 'Package/Stash.pm' => [qw( Package/Stash/PP.pm Package/Stash/XS.pm )], | ||||||||||||||||||||||||||||||||
| 480 | 'Pango.pm' => [qw( Cairo.pm )], # Pango.pm does: eval "use Cairo;" | ||||||||||||||||||||||||||||||||
| 481 | 'PAR/Repository.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 482 | 'PAR/Repository/Client.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 483 | 'Params/Validate.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 484 | 'Parse/AFP.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 485 | 'Parse/Binary.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 486 | 'PDF/API2/Resource/Font.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | 'PDF/API2/Basic/TTF/Font.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 488 | 0 | _glob_in_inc('PDF/API2/Basic/TTF', 1); | |||||||||||||||||||||||||||||||
| 489 | }, | ||||||||||||||||||||||||||||||||
| 490 | 'PDF/Writer.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 491 | 'PDL/NiceSlice.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 492 | 'Perl/Critic.pm' => 'sub', #not only Perl/Critic/Policy | ||||||||||||||||||||||||||||||||
| 493 | 'PerlIO.pm' => [qw( PerlIO/scalar.pm )], | ||||||||||||||||||||||||||||||||
| 494 | 'Pod/Simple/Transcode.pm' => [qw( Pod/Simple/TranscodeDumb.pm Pod/Simple/TranscodeSmart.pm )], | ||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | 'Pod/Usage.pm' => sub { # from Pod::Usage (as of 1.61) | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | $] >= 5.005_58 ? 'Pod/Text.pm' : 'Pod/PlainText.pm' | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 497 | }, | ||||||||||||||||||||||||||||||||
| 498 | 'POE.pm' => [qw( POE/Kernel.pm POE/Session.pm )], | ||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | 'POE/Component/Client/HTTP.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 500 | 0 | _glob_in_inc('POE/Component/Client/HTTP', 1), | |||||||||||||||||||||||||||||||
| 501 | qw( POE/Filter/HTTPChunk.pm POE/Filter/HTTPHead.pm ), | ||||||||||||||||||||||||||||||||
| 502 | }, | ||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | 'POE/Kernel.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 504 | 0 | _glob_in_inc('POE/XS/Resource', 1), | |||||||||||||||||||||||||||||||
| 505 | _glob_in_inc('POE/Resource', 1), | ||||||||||||||||||||||||||||||||
| 506 | _glob_in_inc('POE/XS/Loop', 1), | ||||||||||||||||||||||||||||||||
| 507 | _glob_in_inc('POE/Loop', 1), | ||||||||||||||||||||||||||||||||
| 508 | }, | ||||||||||||||||||||||||||||||||
| 509 | 11 | ▶ | 'POSIX.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 510 | map $_->{name}, | ||||||||||||||||||||||||||||||||
| 511 | 11 | _glob_in_inc('auto/POSIX/SigAction', 0), # *.al files | |||||||||||||||||||||||||||||||
| 512 | _glob_in_inc('auto/POSIX/SigRt', 0), # *.al files | ||||||||||||||||||||||||||||||||
| 513 | }, | ||||||||||||||||||||||||||||||||
| 514 | 'PPI.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||
| 516 | 'Regexp/Common.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | 'RPC/XML/ParserFactory.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 518 | 0 | _glob_in_inc('RPC/XML/Parser', 1); | |||||||||||||||||||||||||||||||
| 519 | }, | ||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||
| 521 | 'SerialJunk.pm' => [qw( | ||||||||||||||||||||||||||||||||
| 522 | termios.ph asm/termios.ph sys/termiox.ph sys/termios.ph sys/ttycom.ph | ||||||||||||||||||||||||||||||||
| 523 | )], | ||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | 'SOAP/Lite.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 525 | 0 | _glob_in_inc('SOAP/Transport', 1), | |||||||||||||||||||||||||||||||
| 526 | _glob_in_inc('SOAP/Lite', 1), | ||||||||||||||||||||||||||||||||
| 527 | }, | ||||||||||||||||||||||||||||||||
| 528 | 'Socket/GetAddrInfo.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 529 | 'Specio/PartialDump.pm' => \&_unicore, | ||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | 'SQL/Parser.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 531 | 0 | _glob_in_inc('SQL/Dialects', 1); | |||||||||||||||||||||||||||||||
| 532 | }, | ||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | 'SQL/Translator/Schema.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 534 | 0 | _glob_in_inc('SQL/Translator', 1); | |||||||||||||||||||||||||||||||
| 535 | }, | ||||||||||||||||||||||||||||||||
| 536 | 'Sub/Exporter/Progressive.pm' => [qw( Sub/Exporter.pm )], | ||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | 'SVK/Command.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 538 | 0 | _glob_in_inc('SVK', 1); | |||||||||||||||||||||||||||||||
| 539 | }, | ||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | 'SVN/Core.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 541 | _glob_in_inc('SVN', 1), | ||||||||||||||||||||||||||||||||
| 542 | 0 | map { $_->{name} } _glob_in_inc('auto/SVN', 0), # *.so, *.bs files | |||||||||||||||||||||||||||||||
| 543 | }, | ||||||||||||||||||||||||||||||||
| 544 | 'Syntax/Keyword/Combine/Keys.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 545 | 'Syntax/Keyword/Defer.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 546 | 'Syntax/Keyword/Dynamically.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 547 | 'Syntax/Keyword/Inplace.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 548 | 'Syntax/Keyword/Match.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 549 | 'Syntax/Keyword/Try.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||
| 551 | 'Template.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 552 | 'Term/ReadLine.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 553 | 'Test/Deep.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 554 | 'threads/shared.pm' => [qw( attributes.pm )], | ||||||||||||||||||||||||||||||||
| 555 | # anybody using threads::shared is likely to declare variables | ||||||||||||||||||||||||||||||||
| 556 | # with attribute :shared | ||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | 'Tk.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 558 | 0 | $SeenTk = 1; | |||||||||||||||||||||||||||||||
| 559 | 0 | qw( Tk/FileSelect.pm Encode/Unicode.pm ); | |||||||||||||||||||||||||||||||
| 560 | }, | ||||||||||||||||||||||||||||||||
| 561 | 'Tk/Balloon.pm' => [qw( Tk/balArrow.xbm )], | ||||||||||||||||||||||||||||||||
| 562 | 'Tk/BrowseEntry.pm' => [qw( Tk/cbxarrow.xbm Tk/arrowdownwin.xbm )], | ||||||||||||||||||||||||||||||||
| 563 | 'Tk/ColorEditor.pm' => [qw( Tk/ColorEdit.xpm )], | ||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | 'Tk/DragDrop/Common.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 565 | 0 | _glob_in_inc('Tk/DragDrop', 1), | |||||||||||||||||||||||||||||||
| 566 | }, | ||||||||||||||||||||||||||||||||
| 567 | 'Tk/FBox.pm' => [qw( Tk/folder.xpm Tk/file.xpm )], | ||||||||||||||||||||||||||||||||
| 568 | 'Tk/Getopt.pm' => [qw( Tk/openfolder.xpm Tk/win.xbm )], | ||||||||||||||||||||||||||||||||
| 569 | 'Tk/Toplevel.pm' => [qw( Tk/Wm.pm )], | ||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||
| 571 | 'Unicode/Normalize.pm' => \&_unicore, | ||||||||||||||||||||||||||||||||
| 572 | 'Unicode/UCD.pm' => \&_unicore, | ||||||||||||||||||||||||||||||||
| 573 | 15 | ▶ | 'URI.pm' => sub { grep !/urn/, _glob_in_inc('URI', 1) }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 574 | 'utf8_heavy.pl' => \&_unicore, | ||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||
| 576 | 'Win32/EventLog.pm' => [qw( Win32/IPC.pm )], | ||||||||||||||||||||||||||||||||
| 577 | 'Win32/Exe.pm' => 'sub', | ||||||||||||||||||||||||||||||||
| 578 | 'Win32/TieRegistry.pm' => [qw( Win32API/Registry.pm )], | ||||||||||||||||||||||||||||||||
| 579 | 'Win32/SystemInfo.pm' => [qw( Win32/cpuspd.dll )], | ||||||||||||||||||||||||||||||||
| 580 | 'Wx.pm' => [qw( attributes.pm )], | ||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | 'XML/Parser.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 583 | 0 | _glob_in_inc('XML/Parser/Style', 1), | |||||||||||||||||||||||||||||||
| 584 | _glob_in_inc('XML/Parser/Encodings', 1), | ||||||||||||||||||||||||||||||||
| 585 | }, | ||||||||||||||||||||||||||||||||
| 586 | 'XML/SAX.pm' => [qw( XML/SAX/ParserDetails.ini ) ], | ||||||||||||||||||||||||||||||||
| 587 | 'XML/Twig.pm' => [qw( URI.pm )], # or URI::File or LWP | ||||||||||||||||||||||||||||||||
| 588 | 'XML/Twig/XPath.pm' => [qw( XML/XPathEngine.pm XML/XPath.pm )], | ||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | 'XMLRPC/Lite.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 590 | 0 | _glob_in_inc('XMLRPC/Transport', 1); | |||||||||||||||||||||||||||||||
| 591 | }, | ||||||||||||||||||||||||||||||||
| 592 | 'XS/Parse/Keyword/FromPerl.pm' => [qw( XS/Parse/Keyword.pm )], | ||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||
| 594 | 'YAML.pm' => [qw( YAML/Loader.pm YAML/Dumper.pm )], | ||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | 'YAML/Any.pm' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 596 | # try to figure out what YAML::Any would have used | ||||||||||||||||||||||||||||||||
| 597 | 0 | my $impl = eval "use YAML::Any; YAML::Any->implementation;"; | |||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | return _mod2pm($impl) unless $@; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||
| 600 | 0 | _glob_in_inc('YAML', 1); # fallback | |||||||||||||||||||||||||||||||
| 601 | }, | ||||||||||||||||||||||||||||||||
| 602 | 19 | ); | |||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||
| 604 | # }}} | ||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||
| 606 | 157 | ▶ | sub path_to_inc_name($$) { | ||||||||||||||||||||||||||||||
|
Subroutine
path_to_inc_name: called CC=6 SCAR=18.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 607 | 157 | my $path = shift; | |||||||||||||||||||||||||||||||
| 608 | 157 | my $warn = shift; | |||||||||||||||||||||||||||||||
| 609 | 157 | my $inc_name; | |||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||
| 611 | 157 | ▶ | if ($path =~ m/\.pm$/io) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 612 | 34 | ▶ | die "$path doesn't exist" unless (-f $path); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 613 | 34 | my $module_info = Module::Metadata->new_from_file($path); | |||||||||||||||||||||||||||||||
| 614 | 34 | ▶ | die "Module::Metadata error: $!" unless defined($module_info); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 615 | 34 | $inc_name = $module_info->name(); | |||||||||||||||||||||||||||||||
| 616 | 34 | ▶ | if (defined($inc_name)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 617 | 34 | $inc_name =~ s|\:\:|\/|og; | |||||||||||||||||||||||||||||||
| 618 | 34 | $inc_name .= '.pm'; | |||||||||||||||||||||||||||||||
| 619 | } else { | ||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | warn "# Couldn't find include name for $path\n" if $warn; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||
| 622 | } else { | ||||||||||||||||||||||||||||||||
| 623 | # Bad solution! | ||||||||||||||||||||||||||||||||
| 624 | 123 | (my $vol, my $dir, $inc_name) = File::Spec->splitpath($path); | |||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||
| 627 | 157 | return $inc_name; | |||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||
| 630 | 19 | my $Keys = 'files|keys|recurse|rv|skip|first|execute|compile|warn_missing|cache_cb|cache_file'; | |||||||||||||||||||||||||||||||
| 631 | 40 | ▶ | sub scan_deps { | ||||||||||||||||||||||||||||||
|
Subroutine
scan_deps: called CC=14 SCAR=26.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 632 | 40 | ▶ | my %args = ( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ and $_[0] =~ /^(?:$Keys)$/o
MC/DC50%1/2
@_ and $_[0] =~ /^(?:$Keys)$/o
@_
$_[0] =~ /^(?:$Keys)$/o
Truth table66%2/3
A and B
A= @_B= $_[0] =~ /^(?:$Keys)$/o
| |||||||||||||||||||||||||||||||||
| 633 | rv => {}, | ||||||||||||||||||||||||||||||||
| 634 | (@_ and $_[0] =~ /^(?:$Keys)$/o) ? @_ : (files => [@_], recurse => 1) | ||||||||||||||||||||||||||||||||
| 635 | ); | ||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||
| 637 | 40 | ▶ | if (!defined($args{keys})) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 638 | 39 | $args{keys} = [map {path_to_inc_name($_, $args{warn_missing})} @{$args{files}}]; | |||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||
| 640 | 40 | my $cache_file = $args{cache_file}; | |||||||||||||||||||||||||||||||
| 641 | 40 | my $using_cache; | |||||||||||||||||||||||||||||||
| 642 | 40 | ▶ | if ($cache_file) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 643 | 8 | require Module::ScanDeps::Cache; | |||||||||||||||||||||||||||||||
| 644 | 8 | $using_cache = Module::ScanDeps::Cache::init_from_file($cache_file); | |||||||||||||||||||||||||||||||
| 645 | 8 | ▶ | if( $using_cache ){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 646 | 8 | $args{cache_cb} = Module::ScanDeps::Cache::get_cache_cb(); | |||||||||||||||||||||||||||||||
| 647 | }else{ | ||||||||||||||||||||||||||||||||
| 648 | 0 | my @missing = Module::ScanDeps::Cache::prereq_missing(); | |||||||||||||||||||||||||||||||
| 649 | 0 | warn join(' ', | |||||||||||||||||||||||||||||||
| 650 | "Can not use cache_file: Needs Modules [", | ||||||||||||||||||||||||||||||||
| 651 | @missing, | ||||||||||||||||||||||||||||||||
| 652 | "]\n",); | ||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||
| 655 | 40 | my ($type, $path); | |||||||||||||||||||||||||||||||
| 656 | 40 | foreach my $input_file (@{$args{files}}) { | |||||||||||||||||||||||||||||||
| 657 | 57 | ▶ | if ($input_file !~ $ScanFileRE) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 658 | warn "Skipping input file $input_file" | ||||||||||||||||||||||||||||||||
| 659 | . " because it doesn't match \$Module::ScanDeps::ScanFileRE\n" | ||||||||||||||||||||||||||||||||
| 660 | 1 | ▶ | if $args{warn_missing}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 661 | 1 | next; | |||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||
| 664 | 56 | $type = _gettype($input_file); | |||||||||||||||||||||||||||||||
| 665 | 56 | $path = $input_file; | |||||||||||||||||||||||||||||||
| 666 | 56 | ▶ | if ($type eq 'module') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 667 | # necessary because add_deps does the search for shared libraries and such | ||||||||||||||||||||||||||||||||
| 668 | add_deps( | ||||||||||||||||||||||||||||||||
| 669 | used_by => undef, | ||||||||||||||||||||||||||||||||
| 670 | rv => $args{rv}, | ||||||||||||||||||||||||||||||||
| 671 | modules => [path_to_inc_name($path, $args{warn_missing})], | ||||||||||||||||||||||||||||||||
| 672 | skip => undef, | ||||||||||||||||||||||||||||||||
| 673 | warn_missing => $args{warn_missing}, | ||||||||||||||||||||||||||||||||
| 674 | 11 | ); | |||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||
| 676 | else { | ||||||||||||||||||||||||||||||||
| 677 | _add_info( | ||||||||||||||||||||||||||||||||
| 678 | rv => $args{rv}, | ||||||||||||||||||||||||||||||||
| 679 | 45 | module => path_to_inc_name($path, $args{warn_missing}), | |||||||||||||||||||||||||||||||
| 680 | file => $path, | ||||||||||||||||||||||||||||||||
| 681 | used_by => undef, | ||||||||||||||||||||||||||||||||
| 682 | type => $type, | ||||||||||||||||||||||||||||||||
| 683 | ); | ||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||
| 687 | { | ||||||||||||||||||||||||||||||||
| 688 | ## "use lib" idioms | ||||||||||||||||||||||||||||||||
| 689 | # | ||||||||||||||||||||||||||||||||
| 690 | # We want to correctly interprete stuff like | ||||||||||||||||||||||||||||||||
| 691 | # | ||||||||||||||||||||||||||||||||
| 692 | # use FindBin; | ||||||||||||||||||||||||||||||||
| 693 | # use lib "$FindBin/../lib"; | ||||||||||||||||||||||||||||||||
| 694 | # | ||||||||||||||||||||||||||||||||
| 695 | # Find out what $FindBin::Bin etc would have been if "use FindBin" had been | ||||||||||||||||||||||||||||||||
| 696 | # called in the first file to analyze. | ||||||||||||||||||||||||||||||||
| 697 | # | ||||||||||||||||||||||||||||||||
| 698 | # Notes: | ||||||||||||||||||||||||||||||||
| 699 | # (1) We don't want to reimplement FindBin, hence fake $0 locally (as the path of the | ||||||||||||||||||||||||||||||||
| 700 | # first file analyzed) and call FindBin::again(). | ||||||||||||||||||||||||||||||||
| 701 | # (2) If the caller of scan_deps() itself uses FindBin, we don't want to overwrite | ||||||||||||||||||||||||||||||||
| 702 | # the value of "their" $FindBin::Bin. | ||||||||||||||||||||||||||||||||
| 703 | # | ||||||||||||||||||||||||||||||||
| 704 | # Other idioms seen sometimes: | ||||||||||||||||||||||||||||||||
| 705 | # | ||||||||||||||||||||||||||||||||
| 706 | # use lib "$ENV{FOO}/path"; | ||||||||||||||||||||||||||||||||
| 707 | # use lib File::Spec->catdir($FindBin::Bin, qw[.. qqlib] ); | ||||||||||||||||||||||||||||||||
| 708 | # use lib catdir(dirname($0), "perl"); | ||||||||||||||||||||||||||||||||
| 709 | # use lib dirname(abs_path($0)); | ||||||||||||||||||||||||||||||||
| 710 | # | ||||||||||||||||||||||||||||||||
| 711 | # In order to correctly interprete these, the modules referenced have to be imported. | ||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||
| 714 | 40 | require FindBin; | |||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||
| 716 | 40 | local $FindBin::Bin; | |||||||||||||||||||||||||||||||
| 717 | #local $FindBin::RealBin; | ||||||||||||||||||||||||||||||||
| 718 | #local $FindBin::Script; | ||||||||||||||||||||||||||||||||
| 719 | #local $FindBin::RealScript; | ||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||
| 721 | 40 | my $_0 = $args{files}[0]; | |||||||||||||||||||||||||||||||
| 722 | 40 | local *0 = \$_0; | |||||||||||||||||||||||||||||||
| 723 | 40 | FindBin->again(); | |||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||
| 725 | 40 | scan_deps_static(\%args); | |||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||
| 728 | 40 | ▶ | if ($args{execute} or $args{compile}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"execute"} or $args{"compile"}
MC/DC0%0/2
$args{"execute"} or $args{"compile"}
$args{"execute"}
$args{"compile"}
Truth table33%1/3
A or B
A= $args{"execute"}B= $args{"compile"}
| |||||||||||||||||||||||||||||||||
| 729 | scan_deps_runtime( | ||||||||||||||||||||||||||||||||
| 730 | rv => $args{rv}, | ||||||||||||||||||||||||||||||||
| 731 | files => $args{files}, | ||||||||||||||||||||||||||||||||
| 732 | execute => $args{execute}, | ||||||||||||||||||||||||||||||||
| 733 | compile => $args{compile}, | ||||||||||||||||||||||||||||||||
| 734 | skip => $args{skip} | ||||||||||||||||||||||||||||||||
| 735 | 0 | ); | |||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||
| 738 | 40 | ▶ | if ( $using_cache ){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 739 | 8 | Module::ScanDeps::Cache::store_cache(); | |||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||
| 742 | # do not include the input files themselves as dependencies! | ||||||||||||||||||||||||||||||||
| 743 | 40 | delete $args{rv}{$_} foreach @{$args{files}}; | |||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||
| 745 | 40 | return ($args{rv}); | |||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||
| 748 | 129 | ▶ | sub scan_deps_static { | ||||||||||||||||||||||||||||||
|
Subroutine
scan_deps_static: called CC=15 SCAR=27.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 749 | 129 | my ($args) = @_; | |||||||||||||||||||||||||||||||
| 750 | my ($files, $keys, $recurse, $rv, | ||||||||||||||||||||||||||||||||
| 751 | $skip, $first, $execute, $compile, | ||||||||||||||||||||||||||||||||
| 752 | $cache_cb, $_skip) | ||||||||||||||||||||||||||||||||
| 753 | 129 | = @$args{qw( files keys recurse rv | |||||||||||||||||||||||||||||||
| 754 | skip first execute compile | ||||||||||||||||||||||||||||||||
| 755 | cache_cb _skip )}; | ||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||
| 757 | 129 | ▶ | $rv ||= {}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$rv ||= {}
MC/DC0%0/1
$rv ||= {}
$rv
Truth table50%1/2
A
A= $rv
| |||||||||||||||||||||||||||||||||
| 758 | 129 | ▶ | $_skip ||= { %{$skip || {}} }; | ||||||||||||||||||||||||||||||
|
Condition100%4/4
$_skip ||= {%{$skip or {};}}
$skip || {}
MC/DC100%1/1
$_skip ||= {%{$skip or {};}}
$_skip
MC/DC100%1/1
$skip || {}
$skip
Truth table100%2/2
A
A= $_skip
Truth table100%2/2
A
A= $skip
| |||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||
| 760 | 129 | foreach my $file (@{$files}) { | |||||||||||||||||||||||||||||||
| 761 | 10347 | my $key = shift @{$keys}; | |||||||||||||||||||||||||||||||
| 762 | 10347 | ▶ | next if $_skip->{$file}++; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 763 | next if is_insensitive_fs() | ||||||||||||||||||||||||||||||||
| 764 | 1379 | and $file ne lc($file) and $_skip->{lc($file)}++; | |||||||||||||||||||||||||||||||
| 765 | 1379 | ▶ | next unless $file =~ $ScanFileRE; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||
| 767 | 1370 | my @pm; | |||||||||||||||||||||||||||||||
| 768 | my $found_in_cache; | ||||||||||||||||||||||||||||||||
| 769 | 1370 | ▶ | if ($cache_cb){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 770 | 51 | my $pm_aref; | |||||||||||||||||||||||||||||||
| 771 | # cache_cb populates \@pm on success | ||||||||||||||||||||||||||||||||
| 772 | 51 | $found_in_cache = $cache_cb->(action => 'read', | |||||||||||||||||||||||||||||||
| 773 | key => $key, | ||||||||||||||||||||||||||||||||
| 774 | file => $file, | ||||||||||||||||||||||||||||||||
| 775 | modules => \@pm, | ||||||||||||||||||||||||||||||||
| 776 | ); | ||||||||||||||||||||||||||||||||
| 777 | 51 | ▶ | unless( $found_in_cache ){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 778 | 20 | @pm = scan_file($file); | |||||||||||||||||||||||||||||||
| 779 | 20 | $cache_cb->(action => 'write', | |||||||||||||||||||||||||||||||
| 780 | key => $key, | ||||||||||||||||||||||||||||||||
| 781 | file => $file, | ||||||||||||||||||||||||||||||||
| 782 | modules => \@pm, | ||||||||||||||||||||||||||||||||
| 783 | ); | ||||||||||||||||||||||||||||||||
| 784 | } | ||||||||||||||||||||||||||||||||
| 785 | }else{ # no caching callback given | ||||||||||||||||||||||||||||||||
| 786 | 1319 | @pm = scan_file($file); | |||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||
| 789 | 1370 | foreach my $pm (@pm){ | |||||||||||||||||||||||||||||||
| 790 | add_deps( | ||||||||||||||||||||||||||||||||
| 791 | used_by => $key, | ||||||||||||||||||||||||||||||||
| 792 | rv => $args->{rv}, | ||||||||||||||||||||||||||||||||
| 793 | modules => [$pm], | ||||||||||||||||||||||||||||||||
| 794 | skip => $args->{skip}, | ||||||||||||||||||||||||||||||||
| 795 | warn_missing => $args->{warn_missing}, | ||||||||||||||||||||||||||||||||
| 796 | 2712 | ); | |||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||
| 798 | 2712 | ▶ | my @preload = _get_preload($pm) or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||
| 800 | add_deps( | ||||||||||||||||||||||||||||||||
| 801 | used_by => $key, | ||||||||||||||||||||||||||||||||
| 802 | rv => $args->{rv}, | ||||||||||||||||||||||||||||||||
| 803 | modules => \@preload, | ||||||||||||||||||||||||||||||||
| 804 | skip => $args->{skip}, | ||||||||||||||||||||||||||||||||
| 805 | warn_missing => $args->{warn_missing}, | ||||||||||||||||||||||||||||||||
| 806 | 98 | ); | |||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||
| 810 | # Top-level recursion handling {{{ | ||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||
| 812 | # prevent utf8.pm from being scanned | ||||||||||||||||||||||||||||||||
| 813 | 129 | ▶ | $_skip->{$rv->{"utf8.pm"}{file}}++ if $rv->{"utf8.pm"}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||
| 815 | 129 | ▶ | while ($recurse) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 816 | 89 | my $count = keys %$rv; | |||||||||||||||||||||||||||||||
| 817 | 89 | ▶ | my @files = sort grep { defined $_->{file} && -T $_->{file} } values %$rv; | ||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $_->{'file'} && -T $_->{'file'}
MC/DC50%1/2
defined $_->{'file'} && -T $_->{'file'}
defined $_->{'file'}
-T $_->{'file'}
Truth table66%2/3
A && B
A= defined $_->{'file'}B= -T $_->{'file'}
| |||||||||||||||||||||||||||||||||
| 818 | scan_deps_static({ | ||||||||||||||||||||||||||||||||
| 819 | files => [ map $_->{file}, @files ], | ||||||||||||||||||||||||||||||||
| 820 | 89 | keys => [ map $_->{key}, @files ], | |||||||||||||||||||||||||||||||
| 821 | rv => $rv, | ||||||||||||||||||||||||||||||||
| 822 | skip => $skip, | ||||||||||||||||||||||||||||||||
| 823 | recurse => 0, | ||||||||||||||||||||||||||||||||
| 824 | cache_cb => $cache_cb, | ||||||||||||||||||||||||||||||||
| 825 | _skip => $_skip, | ||||||||||||||||||||||||||||||||
| 826 | }); | ||||||||||||||||||||||||||||||||
| 827 | 89 | ▶ | last if $count == keys %$rv; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||
| 830 | # }}} | ||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||
| 832 | 129 | return $rv; | |||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||
| 835 | 18 | ▶ | sub scan_deps_runtime { | ||||||||||||||||||||||||||||||
|
Subroutine
scan_deps_runtime: called CC=10 SCAR=24.2
Pod
documented
| |||||||||||||||||||||||||||||||||
| 836 | 18 | ▶ | my %args = ( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and $_[0] =~ /^(?:$Keys)$/o
MC/DC0%0/2
@_ and $_[0] =~ /^(?:$Keys)$/o
@_
$_[0] =~ /^(?:$Keys)$/o
Truth table33%1/3
A and B
A= @_B= $_[0] =~ /^(?:$Keys)$/o
| |||||||||||||||||||||||||||||||||
| 837 | rv => {}, | ||||||||||||||||||||||||||||||||
| 838 | (@_ and $_[0] =~ /^(?:$Keys)$/o) ? @_ : (files => [@_], recurse => 1) | ||||||||||||||||||||||||||||||||
| 839 | ); | ||||||||||||||||||||||||||||||||
| 840 | my ($files, $rv, $execute, $compile) = | ||||||||||||||||||||||||||||||||
| 841 | 18 | @args{qw( files rv execute compile )}; | |||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||
| 843 | 18 | ▶ | $files = (ref($files)) ? $files : [$files]; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||
| 845 | 18 | ▶ | if ($compile) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 846 | 5 | foreach my $file (@$files) { | |||||||||||||||||||||||||||||||
| 847 | 5 | ▶ | next unless $file =~ $ScanFileRE; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||
| 849 | 5 | _merge_rv(_info2rv(_compile_or_execute($file)), $rv); | |||||||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||
| 852 | elsif ($execute) { | ||||||||||||||||||||||||||||||||
| 853 | 13 | foreach my $file (@$files) { | |||||||||||||||||||||||||||||||
| 854 | 13 | ▶ | $execute = [] unless ref $execute; # make sure it's an array ref | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||
| 856 | 13 | _merge_rv(_info2rv(_compile_or_execute($file, $execute)), $rv); | |||||||||||||||||||||||||||||||
| 857 | } | ||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||
| 860 | 18 | return ($rv); | |||||||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||
| 863 | 1339 | ▶ | sub scan_file{ | ||||||||||||||||||||||||||||||
|
Subroutine
scan_file: called CC=13 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 864 | 1339 | my $file = shift; | |||||||||||||||||||||||||||||||
| 865 | 1339 | my %found; | |||||||||||||||||||||||||||||||
| 866 | 1339 | ▶ | open my $fh, "<", $file or die "Cannot open $file: $!"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||
| 868 | 1339 | $SeenTk = 0; | |||||||||||||||||||||||||||||||
| 869 | # Line-by-line scanning | ||||||||||||||||||||||||||||||||
| 870 | LINE: | ||||||||||||||||||||||||||||||||
| 871 | 1339 | ▶ | while (my $line = <$fh>) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 872 | 626180 | chomp($line); | |||||||||||||||||||||||||||||||
| 873 | 626180 | foreach my $pm (scan_line($line)) { | |||||||||||||||||||||||||||||||
| 874 | 4261 | ▶ | last LINE if $pm eq '__END__'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||
| 876 | 3847 | ▶ | if ($pm eq '__POD__') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 877 | 238 | ▶ | while ($line = <$fh>) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 878 | 14345 | ▶ | next LINE if $line =~ /^=cut/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||
| 882 | # Skip Tk hits from Term::ReadLine and Tcl::Tk | ||||||||||||||||||||||||||||||||
| 883 | 3611 | my $pathsep = qr/\/|\\|::/; | |||||||||||||||||||||||||||||||
| 884 | 3611 | ▶ | if ($pm =~ /^Tk\b/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | next if $file =~ /(?:^|${pathsep})Term${pathsep}ReadLine\.pm$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | next if $file =~ /(?:^|${pathsep})Tcl${pathsep}Tk\W/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||
| 888 | 3611 | ▶ | $SeenTk ||= $pm =~ /Tk\.pm$/; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$SeenTk ||= $pm =~ /Tk\.pm$/
MC/DC0%0/2
$SeenTk ||= $pm =~ /Tk\.pm$/
$SeenTk
$pm =~ /Tk\.pm$/
Truth table33%1/3
A ||= B
A= $SeenTkB= $pm =~ /Tk\.pm$/
| |||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||
| 890 | 3611 | $found{$pm}++; | |||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||||||
| 893 | 1339 | ▶ | close $fh or die "Cannot close $file: $!"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 894 | 1339 | return keys %found; | |||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||
| 897 | 626202 | ▶ | sub scan_line { | ||||||||||||||||||||||||||||||
|
Subroutine
scan_line: called CC=19 SCAR=29.5
Pod
documented
| |||||||||||||||||||||||||||||||||
| 898 | 626202 | my $line = shift; | |||||||||||||||||||||||||||||||
| 899 | 626202 | my %found; | |||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||
| 901 | 626202 | ▶ | return '__END__' if $line =~ /^__(?:END|DATA)__$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 902 | 625788 | ▶ | return '__POD__' if $line =~ /^=\w/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||
| 904 | 625550 | $line =~ s/\s*#.*$//; | |||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||
| 906 | CHUNK: | ||||||||||||||||||||||||||||||||
| 907 | 625550 | foreach (split(/;/, $line)) { | |||||||||||||||||||||||||||||||
| 908 | 524475 | s/^\s*//; | |||||||||||||||||||||||||||||||
| 909 | 524475 | s/^\w+:\s*//; # remove LABEL: | |||||||||||||||||||||||||||||||
| 910 | 524475 | s/^(?:do\s*)?\{\s*//; # handle single line blocks like 'do { package foo; use xx; }' | |||||||||||||||||||||||||||||||
| 911 | 524475 | s/\s*\}$//; | |||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||
| 913 | 524475 | ▶ | if (/^package\s+(\w+)/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 914 | 734 | $CurrentPackage = $1; | |||||||||||||||||||||||||||||||
| 915 | 734 | $CurrentPackage =~ s{::}{/}g; | |||||||||||||||||||||||||||||||
| 916 | 734 | next CHUNK; | |||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||
| 918 | # use VERSION: | ||||||||||||||||||||||||||||||||
| 919 | 523741 | ▶ | if (/^(?:use|require)\s+v?(\d[\d\._]*)/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 920 | # include feature.pm if we have 5.9.5 or better | ||||||||||||||||||||||||||||||||
| 921 | 128 | ▶ | if (version->new($1) >= version->new("5.9.5")) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 922 | # seems to catch 5.9, too (but not 5.9.4) | ||||||||||||||||||||||||||||||||
| 923 | 25 | $found{"feature.pm"}++; | |||||||||||||||||||||||||||||||
| 924 | } | ||||||||||||||||||||||||||||||||
| 925 | 128 | next CHUNK; | |||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||
| 928 | 523613 | ▶ | if (my ($pragma, $args) = /^(?:use|no) \s+ (autouse|if) \s+ (.+)/x) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 929 | { | ||||||||||||||||||||||||||||||||
| 930 | # NOTE: There are different ways the MODULE may | ||||||||||||||||||||||||||||||||
| 931 | # be specified for the "autouse" and "if" pragmas, e.g. | ||||||||||||||||||||||||||||||||
| 932 | # use autouse Module => qw(func1 func2); | ||||||||||||||||||||||||||||||||
| 933 | # use autouse "Module", qw(func1); | ||||||||||||||||||||||||||||||||
| 934 | 14 | my $module; | |||||||||||||||||||||||||||||||
| 935 | 14 | ▶ | if ($pragma eq "autouse") { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 936 | 5 | ($module) = _parse_module_list($args); | |||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||
| 938 | else { | ||||||||||||||||||||||||||||||||
| 939 | # The syntax of the "if" pragma is | ||||||||||||||||||||||||||||||||
| 940 | # use if COND, MODULE => ARGUMENTS | ||||||||||||||||||||||||||||||||
| 941 | # NOTE: This works only for simple conditions. | ||||||||||||||||||||||||||||||||
| 942 | 9 | $args =~ s/.*? (?:,|=>) \s*//x; | |||||||||||||||||||||||||||||||
| 943 | 9 | ($module) = _parse_module_list($args); | |||||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||||||
| 945 | 14 | $found{_mod2pm($pragma)}++; | |||||||||||||||||||||||||||||||
| 946 | 14 | ▶ | $found{_mod2pm($module)}++ if $module; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 947 | 14 | next CHUNK; | |||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||
| 950 | 523599 | ▶ | if (my ($how, $libs) = /^(use \s+ lib \s+ | (?:unshift|push) \s+ \@INC \s*,\s*) (.+)/x) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 951 | { | ||||||||||||||||||||||||||||||||
| 952 | 6 | ▶ | my $archname = defined($Config{archname}) ? $Config{archname} : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 953 | 6 | ▶ | my $ver = defined($Config{version}) ? $Config{version} : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 954 | 6 | ▶ | while ((my $dir, $libs) = _parse_libs($libs)) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 955 | { | ||||||||||||||||||||||||||||||||
| 956 | 4 | ▶ | next unless defined $dir; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 957 | 4 | my @dirs = $dir; | |||||||||||||||||||||||||||||||
| 958 | 4 | ▶ | push @dirs, "$dir/$ver", "$dir/$archname", "$dir/$ver/$archname" | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 959 | if $how =~ /lib/; | ||||||||||||||||||||||||||||||||
| 960 | 4 | foreach (@dirs) { | |||||||||||||||||||||||||||||||
| 961 | 16 | ▶ | unshift(@INC, $_) if -d $_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||
| 964 | 6 | next CHUNK; | |||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||
| 967 | 523593 | $found{$_}++ for scan_chunk($_); | |||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||
| 970 | 625550 | return sort keys %found; | |||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||
| 974 | # convert module name to file name | ||||||||||||||||||||||||||||||||
| 975 | 3419 | ▶ | sub _mod2pm { | ||||||||||||||||||||||||||||||
|
Subroutine
_mod2pm: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 976 | 3419 | my $mod = shift; | |||||||||||||||||||||||||||||||
| 977 | 3419 | $mod =~ s!::!/!g; | |||||||||||||||||||||||||||||||
| 978 | 3419 | return "$mod.pm"; | |||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||
| 981 | # parse a comma-separated list of module names (as string literals or qw() lists) | ||||||||||||||||||||||||||||||||
| 982 | 2501 | ▶ | sub _parse_module_list { | ||||||||||||||||||||||||||||||
|
Subroutine
_parse_module_list: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 983 | 2501 | my $list = shift; | |||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||
| 985 | # split $list on anything that's not a word character or ":" | ||||||||||||||||||||||||||||||||
| 986 | # and ignore "q", "qq" and "qw" | ||||||||||||||||||||||||||||||||
| 987 | 2501 | ▶ | return grep { length and !/^:|^q[qw]?$/ } split(/[^\w:]+/, $list); | ||||||||||||||||||||||||||||||
|
Condition100%3/3
length $_ && !/^:|^q[qw]?$/
MC/DC100%2/2
length $_ && !/^:|^q[qw]?$/
length $_
!/^:|^q[qw]?$/
Truth table100%3/3
A && not(B)
A= length $_B= !/^:|^q[qw]?$/
| |||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||
| 990 | # incrementally parse a comma separated list library paths: | ||||||||||||||||||||||||||||||||
| 991 | # returning a pair: the contents of the first strings literal and the remainder of the string | ||||||||||||||||||||||||||||||||
| 992 | # - for "string", 'string', q/string/, qq/string/ also unescape \\ and \<delimiter>) | ||||||||||||||||||||||||||||||||
| 993 | # - for qw(foo bar quux) return ("foo", qw(bar quux)) | ||||||||||||||||||||||||||||||||
| 994 | # - otherwise skip over the first comma and return (undef, "remainder") | ||||||||||||||||||||||||||||||||
| 995 | # - return () if the string is exhausted | ||||||||||||||||||||||||||||||||
| 996 | # - as a special case, if the string starts with $FindBin::Bin, replace it with our $Bin | ||||||||||||||||||||||||||||||||
| 997 | 34 | ▶ | sub _parse_libs { | ||||||||||||||||||||||||||||||
|
Subroutine
_parse_libs: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||
| 998 | 34 | local $_ = shift; | |||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||
| 1000 | 34 | s/^[\s,()]*//; | |||||||||||||||||||||||||||||||
| 1001 | 34 | ▶ | return if $_ eq ""; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||
| 1003 | 29 | ▶ | if (s/^(['"]) ((?:\\.|.)*?) \1//x) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1004 | 9 | return (_unescape($1, $2), $_); | |||||||||||||||||||||||||||||||
| 1005 | } | ||||||||||||||||||||||||||||||||
| 1006 | 20 | ▶ | if (s/^qq? \s* (\W)//x) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1007 | 12 | my $opening_delim = $1; | |||||||||||||||||||||||||||||||
| 1008 | 12 | (my $closing_delim = $opening_delim) =~ tr:([{<:)]}>:; | |||||||||||||||||||||||||||||||
| 1009 | 12 | s/^((?:\\.|.)*?) \Q$closing_delim\E//x; | |||||||||||||||||||||||||||||||
| 1010 | 12 | return (_unescape($opening_delim, $1), $_); | |||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||
| 1013 | 8 | ▶ | if (s/^qw \s* (\W)//x) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1014 | 6 | my $opening_delim = $1; | |||||||||||||||||||||||||||||||
| 1015 | 6 | (my $closing_delim = $opening_delim) =~ tr:([{<:)]}>:; | |||||||||||||||||||||||||||||||
| 1016 | 6 | s/^((?:\\.|.)*?) \Q$closing_delim\E//x; | |||||||||||||||||||||||||||||||
| 1017 | 6 | my $contents = $1; | |||||||||||||||||||||||||||||||
| 1018 | 6 | my @list = split(" ", $contents); | |||||||||||||||||||||||||||||||
| 1019 | 6 | ▶ | return (undef, $_) unless @list; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1020 | 6 | my $first = shift @list; | |||||||||||||||||||||||||||||||
| 1021 | 6 | ▶ | return (_unescape($opening_delim, $first), | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1022 | @list ? "qw${opening_delim}@list${closing_delim}$_" : $_); | ||||||||||||||||||||||||||||||||
| 1023 | } | ||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||
| 1025 | # nothing recognizable in the first list item, skip to the next | ||||||||||||||||||||||||||||||||
| 1026 | 2 | ▶ | if (s/^.*? ,//x) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1027 | 0 | return (undef, $_); | |||||||||||||||||||||||||||||||
| 1028 | } | ||||||||||||||||||||||||||||||||
| 1029 | 2 | return; # list exhausted | |||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||
| 1033 | 27 | ▶ | sub _unescape { | ||||||||||||||||||||||||||||||
|
Subroutine
_unescape: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1034 | 27 | my ($delim, $str) = @_; | |||||||||||||||||||||||||||||||
| 1035 | 27 | $str =~ s/\\([\\\Q$delim\E])/$1/g; | |||||||||||||||||||||||||||||||
| 1036 | 27 | $str =~ s/^\$FindBin::Bin\b/$FindBin::Bin/; | |||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||
| 1038 | 27 | return $str; | |||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||
| 1043 | 523606 | ▶ | sub scan_chunk { | ||||||||||||||||||||||||||||||
|
Subroutine
scan_chunk: called CC=35 SCAR=38.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1044 | 523606 | my $chunk = shift; | |||||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||||||
| 1046 | # Module name extraction heuristics {{{ | ||||||||||||||||||||||||||||||||
| 1047 | 523606 | my $module = eval { | |||||||||||||||||||||||||||||||
| 1048 | 523606 | local $_ = $chunk; | |||||||||||||||||||||||||||||||
| 1049 | 523606 | s/^\s*//; | |||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||
| 1051 | # "if", "while" etc: analyze the expression | ||||||||||||||||||||||||||||||||
| 1052 | 523606 | s/^(?:if|elsif|unless|while|until) \s* \( \s*//x; | |||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||
| 1054 | # "eval" with a block: analyze the block | ||||||||||||||||||||||||||||||||
| 1055 | 523606 | s/^eval \s* \{ \s*//x; | |||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||
| 1057 | # "eval" with an expression that's a string literal: | ||||||||||||||||||||||||||||||||
| 1058 | # analyze the string | ||||||||||||||||||||||||||||||||
| 1059 | 523606 | s/^eval \s+ (?:['"]|qq?\s*\W) \s*//x; | |||||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||||||
| 1061 | # "use LOADER LIST" | ||||||||||||||||||||||||||||||||
| 1062 | # TODO: There's many more of these "loader" type modules on CPAN! | ||||||||||||||||||||||||||||||||
| 1063 | 523606 | ▶ | if (my ($loader, $list) = $_ =~ $LoaderRE) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1064 | 95 | my @mods = _parse_module_list($list); | |||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||
| 1066 | 95 | ▶ | if ($loader eq "Catalyst") { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1067 | # "use Catalyst 'Foo'" looks for "Catalyst::Plugin::Foo", | ||||||||||||||||||||||||||||||||
| 1068 | # but "use Catalyst +Foo" looks for "Foo" | ||||||||||||||||||||||||||||||||
| 1069 | @mods = map { | ||||||||||||||||||||||||||||||||
| 1070 | 2 | ▶ | ($list =~ /([+-])\Q$_\E(?:$|[^\w:])/) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 1071 | ? ($1 eq "-" | ||||||||||||||||||||||||||||||||
| 1072 | ? () # "-Foo": it's a flag, eg. "-Debug", skip it | ||||||||||||||||||||||||||||||||
| 1073 | : $_) # "+Foo": look for "Foo" | ||||||||||||||||||||||||||||||||
| 1074 | : "Catalyst::Plugin::$_" | ||||||||||||||||||||||||||||||||
| 1075 | # "Foo": look for "Catalyst::Plugin::Foo" | ||||||||||||||||||||||||||||||||
| 1076 | } @mods; | ||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||
| 1078 | 95 | return [ map { _mod2pm($_) } $loader, @mods ]; | |||||||||||||||||||||||||||||||
| 1079 | } | ||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||
| 1081 | 523511 | ▶ | if (/^use \s+ Class::Autouse \b \s* (.*)/sx | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
/^use \s+ Class::Autouse \b \s* (.*)/sx or /^Class::Autouse \s* -> \s* autouse \s* (.*)/sx
MC/DC0%0/2
/^use \s+ Class::Autouse \b \s* (.*)/sx or /^Class::Autouse \s* -> \s* autouse \s* (.*)/sx
/^use \s+ Class::Autouse \b \s* (.*)/sx
/^Class::Autouse \s* -> \s* autouse \s* (.*)/sx
Truth table33%1/3
A or B
A= /^use \s+ Class::Autouse \b \s* (.*)/sxB= /^Class::Autouse \s* -> \s* autouse \s* (.*)/sx
| |||||||||||||||||||||||||||||||||
| 1082 | or /^Class::Autouse \s* -> \s* autouse \s* (.*)/sx) { | ||||||||||||||||||||||||||||||||
| 1083 | 0 | return [ map { _mod2pm($_) } "Class::Autouse", _parse_module_list($1) ]; | |||||||||||||||||||||||||||||||
| 1084 | } | ||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||
| 1086 | # generic "use ..." | ||||||||||||||||||||||||||||||||
| 1087 | 523511 | ▶ | if (s/^(?:use|no) \s+//x) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1088 | 2390 | my ($mod) = _parse_module_list($_); # just the first word | |||||||||||||||||||||||||||||||
| 1089 | 2390 | return _mod2pm($mod); | |||||||||||||||||||||||||||||||
| 1090 | } | ||||||||||||||||||||||||||||||||
| 1091 | |||||||||||||||||||||||||||||||||
| 1092 | 521121 | ▶ | if (s/^(require|do) [\s(]+//x) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1093 | 889 | ▶ | return ($1 eq "require" && /^([\w:]+)/) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$1 eq "require" and /^([\w:]+)/
MC/DC100%2/2
$1 eq "require" and /^([\w:]+)/
$1 eq "require"
/^([\w:]+)/
Truth table100%3/3
A and B
A= $1 eq "require"B= /^([\w:]+)/
| |||||||||||||||||||||||||||||||||
| 1094 | ? _mod2pm($1) # bareword ("require" only) | ||||||||||||||||||||||||||||||||
| 1095 | : $_; # maybe string literal? | ||||||||||||||||||||||||||||||||
| 1096 | } | ||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||
| 1098 | 520232 | ▶ | if (/(<[^>]*[^\$\w>][^>]*>)/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1099 | 1001 | my $diamond = $1; | |||||||||||||||||||||||||||||||
| 1100 | 1001 | ▶ | return "File/Glob.pm" if $diamond =~ /[*?\[\]{}~\\]/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1101 | } | ||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||
| 1103 | 520150 | ▶ | return "DBD/$1.pm" if /\bdbi:(\w+):/i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||
| 1105 | # Moose/Moo/Mouse style inheritance or composition | ||||||||||||||||||||||||||||||||
| 1106 | 520150 | ▶ | if (s/^(with|extends)\s+//) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1107 | 2 | return [ map { _mod2pm($_) } _parse_module_list($_) ]; | |||||||||||||||||||||||||||||||
| 1108 | } | ||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||
| 1110 | # check for stuff like | ||||||||||||||||||||||||||||||||
| 1111 | # decode("klingon", ...) | ||||||||||||||||||||||||||||||||
| 1112 | # open FH, "<:encoding(klingon)", ... | ||||||||||||||||||||||||||||||||
| 1113 | 520148 | ▶ | if (my ($args) = /\b(?:open|binmode)\b(.*)/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1114 | 283 | my @mods; | |||||||||||||||||||||||||||||||
| 1115 | 283 | ▶ | push @mods, qw( PerlIO.pm PerlIO/encoding.pm Encode.pm ), _find_encoding($1) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1116 | if $args =~ /:encoding\((.*?)\)/; | ||||||||||||||||||||||||||||||||
| 1117 | 283 | ▶ | while ($args =~ /:(\w+)(?:\((.*?)\))?/g) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1118 | 12 | push @mods, "PerlIO/$1.pm"; | |||||||||||||||||||||||||||||||
| 1119 | 12 | ▶ | push @mods, "Encode.pm", _find_encoding($2) if $1 eq "encoding"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1120 | } | ||||||||||||||||||||||||||||||||
| 1121 | 283 | ▶ | push @mods, "PerlIO.pm" if @mods; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1122 | 283 | ▶ | return \@mods if @mods; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1123 | } | ||||||||||||||||||||||||||||||||
| 1124 | 520139 | ▶ | if (/\b(?:en|de)code\(\s*['"]?([-\w]+)/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1125 | 10 | return [qw( Encode.pm ), _find_encoding($1)]; | |||||||||||||||||||||||||||||||
| 1126 | } | ||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||
| 1128 | 520129 | ▶ | if ($SeenTk) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1129 | 0 | my @modules; | |||||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | while (/->\s*([A-Z]\w+)/g) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1131 | 0 | push @modules, "Tk/$1.pm"; | |||||||||||||||||||||||||||||||
| 1132 | } | ||||||||||||||||||||||||||||||||
| 1133 | 0 | ▶ | while (/->\s*Scrolled\W+([A-Z]\w+)/g) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1134 | 0 | push @modules, "Tk/$1.pm"; | |||||||||||||||||||||||||||||||
| 1135 | 0 | push @modules, "Tk/Scrollbar.pm"; | |||||||||||||||||||||||||||||||
| 1136 | } | ||||||||||||||||||||||||||||||||
| 1137 | 0 | ▶ | if (/->\s*setPalette/g) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1138 | push @modules, | ||||||||||||||||||||||||||||||||
| 1139 | 0 | map { "Tk/$_.pm" } | |||||||||||||||||||||||||||||||
| 1140 | qw( Button Canvas Checkbutton Entry | ||||||||||||||||||||||||||||||||
| 1141 | Frame Label Labelframe Listbox | ||||||||||||||||||||||||||||||||
| 1142 | Menubutton Menu Message Radiobutton | ||||||||||||||||||||||||||||||||
| 1143 | Scale Scrollbar Spinbox Text ); | ||||||||||||||||||||||||||||||||
| 1144 | } | ||||||||||||||||||||||||||||||||
| 1145 | 0 | return \@modules; | |||||||||||||||||||||||||||||||
| 1146 | } | ||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||
| 1148 | # Module::Runtime | ||||||||||||||||||||||||||||||||
| 1149 | 520129 | ▶ | return $_ if s/^(?:require_module|use_module|use_package_optimistically) \s* \( \s*//x; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||
| 1151 | # Test::More | ||||||||||||||||||||||||||||||||
| 1152 | 520129 | ▶ | return $_ if s/^(?:require_ok|use_ok) \s* \( \s*//x; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||
| 1154 | 520127 | return; | |||||||||||||||||||||||||||||||
| 1155 | }; | ||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||
| 1157 | # }}} | ||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||
| 1159 | 523606 | ▶ | return unless defined($module); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1160 | 3479 | ▶ | return wantarray ? @$module : $module->[0] if ref($module); | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||
| 1162 | # extract contents from string literals | ||||||||||||||||||||||||||||||||
| 1163 | 3363 | ▶ | if ($module =~ /^(['"]) (.*?) \1/x) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 1164 | 35 | $module = $2; | |||||||||||||||||||||||||||||||
| 1165 | } | ||||||||||||||||||||||||||||||||
| 1166 | elsif ($module =~ s/^qq? \s* (\W)//x) { | ||||||||||||||||||||||||||||||||
| 1167 | 0 | (my $closing = $1) =~ tr:([{<:)]}>:; | |||||||||||||||||||||||||||||||
| 1168 | 0 | $module =~ s/\Q$closing\E.*//; | |||||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||
| 1171 | 3363 | $module =~ s/::/\//g; | |||||||||||||||||||||||||||||||
| 1172 | 3363 | ▶ | return if $module =~ /^(?:[\d\._]+|'.*[^']|".*[^"])$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||
| 1174 | 3362 | ▶ | $module .= ".pm" unless $module =~ /\./; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1175 | 3362 | return $module; | |||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||
| 1178 | 16 | ▶ | sub _find_encoding { | ||||||||||||||||||||||||||||||
|
Subroutine
_find_encoding: called CC=4 SCAR=15.5
| |||||||||||||||||||||||||||||||||
| 1179 | 16 | my ($enc) = @_; | |||||||||||||||||||||||||||||||
| 1180 | 16 | ▶ | return unless $] >= 5.008 and eval { require Encode; %Encode::ExtModule }; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$] >= "5.008" and eval {
do {
require Encode;
%Encode::ExtModule
}
}
MC/DC0%0/2
$] >= "5.008" and eval {
do {
require Encode;
%Encode::ExtModule
}
}
$] >= "5.008"
eval {
do {
require Encode;
%Encode::ExtModule
}
}
Truth table33%1/3
A and B
A= $] >= "5.008"B= eval {
do {
require Encode;
%Encode::ExtModule
}
}
| |||||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||
| 1182 | 16 | ▶ | my $mod = eval { $Encode::ExtModule{ Encode::find_encoding($enc)->name } } or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1183 | 0 | return _mod2pm($mod); | |||||||||||||||||||||||||||||||
| 1184 | } | ||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||
| 1186 | 5752 | ▶ | sub _add_info { | ||||||||||||||||||||||||||||||
|
Subroutine
_add_info: called CC=8 SCAR=21.3
| |||||||||||||||||||||||||||||||||
| 1187 | 5752 | my %args = @_; | |||||||||||||||||||||||||||||||
| 1188 | 5752 | my ($rv, $module, $file, $used_by, $type) = @args{qw/rv module file used_by type/}; | |||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||
| 1190 | 5752 | ▶ | return unless defined($module) and defined($file); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $module and defined $file
MC/DC0%0/2
defined $module and defined $file
defined $module
defined $file
Truth table33%1/3
A and B
A= defined $moduleB= defined $file
| |||||||||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||||||
| 1192 | # Ensure file is always absolute | ||||||||||||||||||||||||||||||||
| 1193 | 5752 | $file = File::Spec->rel2abs($file); | |||||||||||||||||||||||||||||||
| 1194 | 5752 | $file =~ s|\\|\/|go; | |||||||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||||||
| 1196 | # Avoid duplicates that can arise due to case differences that don't actually | ||||||||||||||||||||||||||||||||
| 1197 | # matter on a case tolerant system | ||||||||||||||||||||||||||||||||
| 1198 | 5752 | if (is_insensitive_fs) { | |||||||||||||||||||||||||||||||
| 1199 | if (!exists $rv->{$module}) { | ||||||||||||||||||||||||||||||||
| 1200 | my $lc_module = lc $module; | ||||||||||||||||||||||||||||||||
| 1201 | 0 | ▶ | my $key = first {lc($_) eq $lc_module} keys %$rv; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 1202 | if (defined $key) { | ||||||||||||||||||||||||||||||||
| 1203 | $module = $key | ||||||||||||||||||||||||||||||||
| 1204 | }; | ||||||||||||||||||||||||||||||||
| 1205 | } | ||||||||||||||||||||||||||||||||
| 1206 | if (defined($used_by)) { | ||||||||||||||||||||||||||||||||
| 1207 | if (lc($used_by) eq lc($module)) { | ||||||||||||||||||||||||||||||||
| 1208 | $used_by = $module; | ||||||||||||||||||||||||||||||||
| 1209 | } else { | ||||||||||||||||||||||||||||||||
| 1210 | if (!exists $rv->{$used_by}) { | ||||||||||||||||||||||||||||||||
| 1211 | my $lc_used_by = lc $used_by; | ||||||||||||||||||||||||||||||||
| 1212 | 0 | ▶ | my $key = first {lc($_) eq $lc_used_by} keys %$rv; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 1213 | if (defined $key) { | ||||||||||||||||||||||||||||||||
| 1214 | $used_by = $key | ||||||||||||||||||||||||||||||||
| 1215 | }; | ||||||||||||||||||||||||||||||||
| 1216 | } | ||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||
| 1218 | } | ||||||||||||||||||||||||||||||||
| 1219 | } | ||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||
| 1221 | 5752 | ▶ | $rv->{$module} ||= { | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$rv->{$module} ||= {"file", $file, "key", $module, "type", $type}
MC/DC100%1/1
$rv->{$module} ||= {"file", $file, "key", $module, "type", $type}
$rv->{$module}
Truth table100%2/2
A
A= $rv->{$module}
| |||||||||||||||||||||||||||||||||
| 1222 | file => $file, | ||||||||||||||||||||||||||||||||
| 1223 | key => $module, | ||||||||||||||||||||||||||||||||
| 1224 | type => $type, | ||||||||||||||||||||||||||||||||
| 1225 | }; | ||||||||||||||||||||||||||||||||
| 1226 | |||||||||||||||||||||||||||||||||
| 1227 | 5752 | ▶ | if (defined($used_by) and $used_by ne $module) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $used_by and $used_by ne $module
MC/DC100%2/2
defined $used_by and $used_by ne $module
defined $used_by
$used_by ne $module
Truth table100%3/3
A and B
A= defined $used_byB= $used_by ne $module
| |||||||||||||||||||||||||||||||||
| 1228 | 5672 | if (is_insensitive_fs) { | |||||||||||||||||||||||||||||||
| 1229 | my $lc_used_by = lc $used_by; | ||||||||||||||||||||||||||||||||
| 1230 | my $lc_module = lc $module; | ||||||||||||||||||||||||||||||||
| 1231 | push @{ $rv->{$module}{used_by} }, $used_by | ||||||||||||||||||||||||||||||||
| 1232 | 0 | ▶ | if !any { lc($_) eq $lc_used_by } @{ $rv->{$module}{used_by} }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 1233 | # We assume here that another _add_info will be called to provide the other parts of $rv->{$used_by} | ||||||||||||||||||||||||||||||||
| 1234 | push @{ $rv->{$used_by}{uses} }, $module | ||||||||||||||||||||||||||||||||
| 1235 | 0 | ▶ | if !any { lc($_) eq $lc_module } @{ $rv->{$used_by}{uses} }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||
| 1237 | else { | ||||||||||||||||||||||||||||||||
| 1238 | 4971 | push @{ $rv->{$module}{used_by} }, $used_by | |||||||||||||||||||||||||||||||
| 1239 | 5672 | ▶ | if !any { $_ eq $used_by } @{ $rv->{$module}{used_by} }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1240 | # We assume here that another _add_info will be called to provide the other parts of $rv->{$used_by} | ||||||||||||||||||||||||||||||||
| 1241 | 4971 | push @{ $rv->{$used_by}{uses} }, $module | |||||||||||||||||||||||||||||||
| 1242 | 5672 | ▶ | if !any { $_ eq $module } @{ $rv->{$used_by}{uses} }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1243 | } | ||||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||
| 1245 | } | ||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||
| 1247 | # This subroutine relies on not being called for modules that have already been visited | ||||||||||||||||||||||||||||||||
| 1248 | 2821 | ▶ | sub add_deps { | ||||||||||||||||||||||||||||||
|
Subroutine
add_deps: called CC=16 SCAR=28.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1249 | 2821 | ▶ | my %args = | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
@_ and $_[0] =~ /^(?:modules|rv|used_by|warn_missing)$/
MC/DC0%0/2
@_ and $_[0] =~ /^(?:modules|rv|used_by|warn_missing)$/
@_
$_[0] =~ /^(?:modules|rv|used_by|warn_missing)$/
Truth table33%1/3
A and B
A= @_B= $_[0] =~ /^(?:modules|rv|used_by|warn_missing)$/
| |||||||||||||||||||||||||||||||||
| 1250 | ((@_ and $_[0] =~ /^(?:modules|rv|used_by|warn_missing)$/) | ||||||||||||||||||||||||||||||||
| 1251 | ? @_ | ||||||||||||||||||||||||||||||||
| 1252 | : (rv => (ref($_[0]) ? shift(@_) : undef), modules => [@_])); | ||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||
| 1254 | 2821 | ▶ | my $rv = $args{rv} || {}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'rv'} || {}
MC/DC0%0/1
$args{'rv'} || {}
$args{'rv'}
Truth table50%1/2
A
A= $args{'rv'}
| |||||||||||||||||||||||||||||||||
| 1255 | 2821 | ▶ | my $skip = $args{skip} || {}; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'skip'} || {}
MC/DC100%1/1
$args{'skip'} || {}
$args{'skip'}
Truth table100%2/2
A
A= $args{'skip'}
| |||||||||||||||||||||||||||||||||
| 1256 | 2821 | my $used_by = $args{used_by}; | |||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||
| 1258 | 2821 | foreach my $module (@{ $args{modules} }) { | |||||||||||||||||||||||||||||||
| 1259 | my $file = _find_in_inc($module) | ||||||||||||||||||||||||||||||||
| 1260 | 5707 | ▶ | or _warn_of_missing_module($module, $args{warn_missing}), next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1261 | 5569 | ▶ | next if $skip->{$file}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||||||
| 1263 | 5568 | ▶ | if (exists $rv->{$module}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1264 | 4341 | _add_info( rv => $rv, module => $module, | |||||||||||||||||||||||||||||||
| 1265 | file => $file, used_by => $used_by, | ||||||||||||||||||||||||||||||||
| 1266 | type => undef ); | ||||||||||||||||||||||||||||||||
| 1267 | 4341 | next; | |||||||||||||||||||||||||||||||
| 1268 | } | ||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||
| 1270 | 1227 | _add_info( rv => $rv, module => $module, | |||||||||||||||||||||||||||||||
| 1271 | file => $file, used_by => $used_by, | ||||||||||||||||||||||||||||||||
| 1272 | type => _gettype($file) ); | ||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||
| 1274 | 1227 | ▶ | if ((my $path = $module) =~ s/\.p[mh]$//i) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1275 | |||||||||||||||||||||||||||||||||
| 1276 | 592 | foreach (_glob_in_inc("auto/$path")) { | |||||||||||||||||||||||||||||||
| 1277 | 235 | ▶ | next if $_->{name} =~ m{^auto/$path/.*/}; # weed out subdirs | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1278 | 162 | ▶ | next if $_->{name} =~ m{/(?:\.exists|\.packlist)$|\Q$Config{lib_ext}\E$}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||
| 1280 | _add_info( rv => $rv, module => $_->{name}, | ||||||||||||||||||||||||||||||||
| 1281 | file => $_->{file}, used_by => $module, | ||||||||||||||||||||||||||||||||
| 1282 | 139 | type => _gettype($_->{name}) ); | |||||||||||||||||||||||||||||||
| 1283 | } | ||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||
| 1285 | ### Now, handle module and distribution share dirs | ||||||||||||||||||||||||||||||||
| 1286 | # convert 'Module/Name' to 'Module-Name' | ||||||||||||||||||||||||||||||||
| 1287 | 592 | my $modname = $path; | |||||||||||||||||||||||||||||||
| 1288 | 592 | $modname =~ s|/|-|g; | |||||||||||||||||||||||||||||||
| 1289 | # TODO: get real distribution name related to module name | ||||||||||||||||||||||||||||||||
| 1290 | 592 | my $distname = $modname; | |||||||||||||||||||||||||||||||
| 1291 | 592 | foreach (_glob_in_inc("auto/share/module/$modname")) { | |||||||||||||||||||||||||||||||
| 1292 | _add_info( rv => $rv, module => $_->{name}, | ||||||||||||||||||||||||||||||||
| 1293 | 0 | file => $_->{file}, used_by => $module, | |||||||||||||||||||||||||||||||
| 1294 | type => 'data' ); | ||||||||||||||||||||||||||||||||
| 1295 | } | ||||||||||||||||||||||||||||||||
| 1296 | 592 | foreach (_glob_in_inc("auto/share/dist/$distname")) { | |||||||||||||||||||||||||||||||
| 1297 | _add_info( rv => $rv, module => $_->{name}, | ||||||||||||||||||||||||||||||||
| 1298 | 0 | file => $_->{file}, used_by => $module, | |||||||||||||||||||||||||||||||
| 1299 | type => 'data' ); | ||||||||||||||||||||||||||||||||
| 1300 | } | ||||||||||||||||||||||||||||||||
| 1301 | } | ||||||||||||||||||||||||||||||||
| 1302 | } # end for modules | ||||||||||||||||||||||||||||||||
| 1303 | 2821 | return $rv; | |||||||||||||||||||||||||||||||
| 1304 | } | ||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||
| 1306 | # invalidate %_file_cache and %_glob_cache in case @INC changes | ||||||||||||||||||||||||||||||||
| 1307 | sub _validate_cached_inc | ||||||||||||||||||||||||||||||||
| 1308 | 7545 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
_validate_cached_inc: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 1309 | 7545 | my $inc = join("\0", @INC, @IncludeLibs); | |||||||||||||||||||||||||||||||
| 1310 | 7545 | ▶ | return if $inc eq $_cached_inc; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||
| 1312 | # blow away the caches | ||||||||||||||||||||||||||||||||
| 1313 | 15 | %_file_cache = (); | |||||||||||||||||||||||||||||||
| 1314 | 15 | %_glob_cache = (); | |||||||||||||||||||||||||||||||
| 1315 | 15 | $_cached_inc = $inc; | |||||||||||||||||||||||||||||||
| 1316 | } | ||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||
| 1318 | 5707 | ▶ | sub _find_in_inc { | ||||||||||||||||||||||||||||||
|
Subroutine
_find_in_inc: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||
| 1319 | 5707 | my $file = shift; | |||||||||||||||||||||||||||||||
| 1320 | 5707 | ▶ | return unless defined $file; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||
| 1322 | 5707 | _validate_cached_inc(); | |||||||||||||||||||||||||||||||
| 1323 | 5707 | my $cached_val = $_file_cache{$file}; | |||||||||||||||||||||||||||||||
| 1324 | 5707 | ▶ | return $cached_val if $cached_val; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||
| 1326 | 1336 | foreach my $dir (grep !/\bBSDPAN\b/, @INC, @IncludeLibs) { | |||||||||||||||||||||||||||||||
| 1327 | 10855 | ▶ | if (-f "$dir/$file") { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1328 | 1198 | $_file_cache{$file} = "$dir/$file"; | |||||||||||||||||||||||||||||||
| 1329 | 1198 | return "$dir/$file" | |||||||||||||||||||||||||||||||
| 1330 | }; | ||||||||||||||||||||||||||||||||
| 1331 | } | ||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||
| 1333 | # absolute file names | ||||||||||||||||||||||||||||||||
| 1334 | 138 | ▶ | return $file if -f $file; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||
| 1336 | 138 | return; | |||||||||||||||||||||||||||||||
| 1337 | } | ||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||
| 1339 | 1838 | ▶ | sub _glob_in_inc { | ||||||||||||||||||||||||||||||
|
Subroutine
_glob_in_inc: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||
| 1340 | 1838 | my ($subdir, $pm_only) = @_; | |||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||
| 1342 | 1838 | require File::Find; | |||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||
| 1344 | 1838 | $subdir =~ s/\$CurrentPackage/$CurrentPackage/; | |||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||
| 1346 | 1838 | _validate_cached_inc(); | |||||||||||||||||||||||||||||||
| 1347 | 1838 | my $cached_val = $_glob_cache{$subdir}; | |||||||||||||||||||||||||||||||
| 1348 | 1838 | ▶ | return @$cached_val if $cached_val; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||
| 1350 | 1689 | my @files; | |||||||||||||||||||||||||||||||
| 1351 | 1689 | foreach my $inc (grep !/\bBSDPAN\b/, @INC, @IncludeLibs) { | |||||||||||||||||||||||||||||||
| 1352 | 15395 | my $dir = "$inc/$subdir"; | |||||||||||||||||||||||||||||||
| 1353 | 15395 | ▶ | next unless -d $dir; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||
| 1355 | # canonicalize $inc (ie. use "/" as filename separator exclusively) | ||||||||||||||||||||||||||||||||
| 1356 | # as newer versions of File::Find return a canonicalized $File::Find::name | ||||||||||||||||||||||||||||||||
| 1357 | 123 | (my $canon = $inc) =~ s|\\|/|g; | |||||||||||||||||||||||||||||||
| 1358 | File::Find::find( | ||||||||||||||||||||||||||||||||
| 1359 | 1243 | ▶ | sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||
| 1360 | 1243 | ▶ | return unless -f $_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1361 | 962 | ▶ | return if $pm_only and !/\.p[mh]$/i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$pm_only and not /\.p[mh]$/i
MC/DC0%0/2
$pm_only and not /\.p[mh]$/i
$pm_only
not /\.p[mh]$/i
Truth table66%2/3
A and not(B)
A= $pm_onlyB= not /\.p[mh]$/i
| |||||||||||||||||||||||||||||||||
| 1362 | 962 | (my $file = $File::Find::name) =~ s|\\|/|g; | |||||||||||||||||||||||||||||||
| 1363 | 962 | (my $name = $file) =~ s|^\Q$canon\E/||; | |||||||||||||||||||||||||||||||
| 1364 | 962 | ▶ | push @files, $pm_only ? $name | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1365 | : { file => $file, name => $name }; | ||||||||||||||||||||||||||||||||
| 1366 | }, | ||||||||||||||||||||||||||||||||
| 1367 | 123 | $dir | |||||||||||||||||||||||||||||||
| 1368 | ); | ||||||||||||||||||||||||||||||||
| 1369 | } | ||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||
| 1371 | 1689 | $_glob_cache{$subdir} = \@files; | |||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||
| 1373 | 1689 | return @files; | |||||||||||||||||||||||||||||||
| 1374 | } | ||||||||||||||||||||||||||||||||
| 1375 | |||||||||||||||||||||||||||||||||
| 1376 | # like _glob_in_inc, but looks only at the first level | ||||||||||||||||||||||||||||||||
| 1377 | # (i.e. the children of $subdir) | ||||||||||||||||||||||||||||||||
| 1378 | # NOTE: File::Find has no public notion of the depth of the traversal | ||||||||||||||||||||||||||||||||
| 1379 | # in its "wanted" callback, so it's not helpful | ||||||||||||||||||||||||||||||||
| 1380 | 0 | ▶ | sub _glob_in_inc_1 { | ||||||||||||||||||||||||||||||
|
Subroutine
_glob_in_inc_1: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||
| 1381 | 0 | my ($subdir, $pm_only) = @_; | |||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||
| 1383 | 0 | $subdir =~ s/\$CurrentPackage/$CurrentPackage/; | |||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||
| 1385 | 0 | my @files; | |||||||||||||||||||||||||||||||
| 1386 | 0 | foreach my $inc (grep !/\bBSDPAN\b/, @INC, @IncludeLibs) { | |||||||||||||||||||||||||||||||
| 1387 | 0 | my $dir = "$inc/$subdir"; | |||||||||||||||||||||||||||||||
| 1388 | 0 | ▶ | next unless -d $dir; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||||||
| 1390 | 0 | ▶ | opendir(my $dh, $dir) or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1391 | 0 | my @names = map { "$subdir/$_" } grep { -f "$dir/$_" } readdir $dh; | |||||||||||||||||||||||||||||||
| 1392 | 0 | closedir $dh; | |||||||||||||||||||||||||||||||
| 1393 | |||||||||||||||||||||||||||||||||
| 1394 | 0 | push @files, $pm_only ? ( grep { /\.p[mh]$/i } @names ) | |||||||||||||||||||||||||||||||
| 1395 | 0 | ▶ | : ( map { { file => "$inc/$_", name => $_ } } @names ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1396 | } | ||||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||
| 1398 | 0 | return @files; | |||||||||||||||||||||||||||||||
| 1399 | } | ||||||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||||||
| 1401 | 19 | my $unicore_stuff; | |||||||||||||||||||||||||||||||
| 1402 | 6 | ▶ | sub _unicore { | ||||||||||||||||||||||||||||||
|
Subroutine
_unicore: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 1403 | 6 | ▶ | $unicore_stuff ||= [ 'utf8_heavy.pl', map $_->{name}, _glob_in_inc('unicore', 0) ]; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$unicore_stuff ||= ["utf8_heavy.pl", map($_->{"name"}, _glob_in_inc("unicore", 0))]
MC/DC100%1/1
$unicore_stuff ||= ["utf8_heavy.pl", map($_->{"name"}, _glob_in_inc("unicore", 0))]
$unicore_stuff
Truth table100%2/2
A
A= $unicore_stuff
| |||||||||||||||||||||||||||||||||
| 1404 | 6 | return @$unicore_stuff; | |||||||||||||||||||||||||||||||
| 1405 | } | ||||||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||||||
| 1407 | # App::Packer compatibility functions | ||||||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||||||
| 1409 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1410 | 1 | my ($class, $self) = @_; | |||||||||||||||||||||||||||||||
| 1411 | 1 | ▶ | return bless($self ||= {}, $class); | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self ||= {}
MC/DC0%0/1
$self ||= {}
$self
Truth table50%1/2
A
A= $self
| |||||||||||||||||||||||||||||||||
| 1412 | } | ||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||
| 1414 | 1 | ▶ | sub set_file { | ||||||||||||||||||||||||||||||
|
Subroutine
set_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1415 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1416 | 1 | my $script = shift; | |||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||
| 1418 | 1 | my ($vol, $dir, $file) = File::Spec->splitpath($script); | |||||||||||||||||||||||||||||||
| 1419 | $self->{main} = { | ||||||||||||||||||||||||||||||||
| 1420 | 1 | key => $file, | |||||||||||||||||||||||||||||||
| 1421 | file => $script, | ||||||||||||||||||||||||||||||||
| 1422 | }; | ||||||||||||||||||||||||||||||||
| 1423 | } | ||||||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||||||
| 1425 | 0 | ▶ | sub set_options { | ||||||||||||||||||||||||||||||
|
Subroutine
set_options: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1426 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1427 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||
| 1428 | 0 | foreach my $module (@{ $args{add_modules} }) { | |||||||||||||||||||||||||||||||
| 1429 | 0 | ▶ | $module = _mod2pm($module) unless $module =~ /\.p[mh]$/i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1430 | my $file = _find_in_inc($module) | ||||||||||||||||||||||||||||||||
| 1431 | 0 | ▶ | or _warn_of_missing_module($module, $args{warn_missing}), next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1432 | 0 | $self->{files}{$module} = $file; | |||||||||||||||||||||||||||||||
| 1433 | } | ||||||||||||||||||||||||||||||||
| 1434 | } | ||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||
| 1436 | 1 | ▶ | sub calculate_info { | ||||||||||||||||||||||||||||||
|
Subroutine
calculate_info: called CC=11 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1437 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1438 | my $rv = scan_deps( | ||||||||||||||||||||||||||||||||
| 1439 | 1 | 'keys' => [ $self->{main}{key}, sort keys %{ $self->{files} }, ], | |||||||||||||||||||||||||||||||
| 1440 | files => [ $self->{main}{file}, | ||||||||||||||||||||||||||||||||
| 1441 | 0 | map { $self->{files}{$_} } sort keys %{ $self->{files} }, | |||||||||||||||||||||||||||||||
| 1442 | ], | ||||||||||||||||||||||||||||||||
| 1443 | recurse => 1, | ||||||||||||||||||||||||||||||||
| 1444 | ); | ||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||
| 1446 | my $info = { | ||||||||||||||||||||||||||||||||
| 1447 | main => { file => $self->{main}{file}, | ||||||||||||||||||||||||||||||||
| 1448 | store_as => $self->{main}{key}, | ||||||||||||||||||||||||||||||||
| 1449 | }, | ||||||||||||||||||||||||||||||||
| 1450 | 1 | }; | |||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||
| 1452 | 1 | my %cache = ($self->{main}{key} => $info->{main}); | |||||||||||||||||||||||||||||||
| 1453 | 1 | foreach my $key (sort keys %{ $self->{files} }) { | |||||||||||||||||||||||||||||||
| 1454 | 0 | my $file = $self->{files}{$key}; | |||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||
| 1456 | $cache{$key} = $info->{modules}{$key} = { | ||||||||||||||||||||||||||||||||
| 1457 | file => $file, | ||||||||||||||||||||||||||||||||
| 1458 | store_as => $key, | ||||||||||||||||||||||||||||||||
| 1459 | 0 | used_by => [ $self->{main}{key} ], | |||||||||||||||||||||||||||||||
| 1460 | }; | ||||||||||||||||||||||||||||||||
| 1461 | } | ||||||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||||||
| 1463 | 1 | foreach my $key (sort keys %{$rv}) { | |||||||||||||||||||||||||||||||
| 1464 | 156 | my $val = $rv->{$key}; | |||||||||||||||||||||||||||||||
| 1465 | 156 | ▶ | if ($cache{ $val->{key} }) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1466 | 1 | ▶ | defined($val->{used_by}) or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1467 | 0 | push @{ $info->{ $val->{type} }->{ $val->{key} }->{used_by} }, | |||||||||||||||||||||||||||||||
| 1468 | 0 | @{ $val->{used_by} }; | |||||||||||||||||||||||||||||||
| 1469 | } | ||||||||||||||||||||||||||||||||
| 1470 | else { | ||||||||||||||||||||||||||||||||
| 1471 | $cache{ $val->{key} } = $info->{ $val->{type} }->{ $val->{key} } = | ||||||||||||||||||||||||||||||||
| 1472 | { file => $val->{file}, | ||||||||||||||||||||||||||||||||
| 1473 | store_as => $val->{key}, | ||||||||||||||||||||||||||||||||
| 1474 | used_by => $val->{used_by}, | ||||||||||||||||||||||||||||||||
| 1475 | 155 | }; | |||||||||||||||||||||||||||||||
| 1476 | } | ||||||||||||||||||||||||||||||||
| 1477 | } | ||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||
| 1479 | 1 | $self->{info} = { main => $info->{main} }; | |||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||
| 1481 | 1 | foreach my $type (sort keys %{$info}) { | |||||||||||||||||||||||||||||||
| 1482 | 4 | ▶ | next if $type eq 'main'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||||||
| 1484 | 3 | my @val; | |||||||||||||||||||||||||||||||
| 1485 | 3 | ▶ | if (UNIVERSAL::isa($info->{$type}, 'HASH')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1486 | 3 | foreach my $val (sort values %{ $info->{$type} }) { | |||||||||||||||||||||||||||||||
| 1487 | 155 | @{ $val->{used_by} } = map $cache{$_} || "!!$_!!", | |||||||||||||||||||||||||||||||
| 1488 | 155 | ▶ | @{ $val->{used_by} }; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$cache{$_} || "!!$_!!"
MC/DC0%0/1
$cache{$_} || "!!$_!!"
$cache{$_}
Truth table50%1/2
A
A= $cache{$_}
| |||||||||||||||||||||||||||||||||
| 1489 | 155 | push @val, $val; | |||||||||||||||||||||||||||||||
| 1490 | } | ||||||||||||||||||||||||||||||||
| 1491 | } | ||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||
| 1493 | 3 | ▶ | $type = 'modules' if $type eq 'module'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1494 | 3 | $self->{info}{$type} = \@val; | |||||||||||||||||||||||||||||||
| 1495 | } | ||||||||||||||||||||||||||||||||
| 1496 | } | ||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||
| 1498 | 1 | ▶ | sub get_files { | ||||||||||||||||||||||||||||||
|
Subroutine
get_files: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1499 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1500 | 1 | return $self->{info}; | |||||||||||||||||||||||||||||||
| 1501 | } | ||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||
| 1503 | 0 | ▶ | sub add_preload_rule { | ||||||||||||||||||||||||||||||
|
Subroutine
add_preload_rule: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1504 | 0 | my ($pm, $rule) = @_; | |||||||||||||||||||||||||||||||
| 1505 | 0 | ▶ | die qq[a preload rule for "$pm" already exists] if $Preload{$pm}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1506 | 0 | $Preload{$pm} = $rule; | |||||||||||||||||||||||||||||||
| 1507 | } | ||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||
| 1509 | # scan_deps_runtime utility functions | ||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||
| 1511 | # compile $file if $execute is undef, | ||||||||||||||||||||||||||||||||
| 1512 | # otherwise execute $file with arguments @$execute | ||||||||||||||||||||||||||||||||
| 1513 | 18 | ▶ | sub _compile_or_execute { | ||||||||||||||||||||||||||||||
|
Subroutine
_compile_or_execute: called CC=9 SCAR=23.2
| |||||||||||||||||||||||||||||||||
| 1514 | 18 | my ($file, $execute) = @_; | |||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||
| 1516 | 18 | local $ENV{MSD_ORIGINAL_FILE} = $file; | |||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||
| 1518 | 18 | my ($ih, $instrumented_file) = File::Temp::tempfile(UNLINK => 1); | |||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||
| 1520 | 18 | my (undef, $data_file) = File::Temp::tempfile(UNLINK => 1); | |||||||||||||||||||||||||||||||
| 1521 | 18 | local $ENV{MSD_DATA_FILE} = $data_file; | |||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||
| 1523 | # spoof $0 (to $file) so that FindBin works as expected | ||||||||||||||||||||||||||||||||
| 1524 | # NOTE: We don't directly assign to $0 as it has magic (i.e. | ||||||||||||||||||||||||||||||||
| 1525 | # assigning has side effects and may actually fail, cf. perlvar(1)). | ||||||||||||||||||||||||||||||||
| 1526 | # Instead we alias *0 to a package variable holding the correct value. | ||||||||||||||||||||||||||||||||
| 1527 | 18 | print $ih <<'...'; | |||||||||||||||||||||||||||||||
| 1528 | BEGIN { my $_0 = $ENV{MSD_ORIGINAL_FILE}; *0 = \$_0; } | ||||||||||||||||||||||||||||||||
| 1529 | ... | ||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||
| 1531 | # NOTE: When compiling the block will run as the last CHECK block; | ||||||||||||||||||||||||||||||||
| 1532 | # when executing the block will run as the first END block and | ||||||||||||||||||||||||||||||||
| 1533 | # the programs continues. | ||||||||||||||||||||||||||||||||
| 1534 | 18 | ▶ | print $ih | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1535 | $execute ? "END\n" : "CHECK\n", | ||||||||||||||||||||||||||||||||
| 1536 | <<'...'; | ||||||||||||||||||||||||||||||||
| 1537 | { | ||||||||||||||||||||||||||||||||
| 1538 | require DynaLoader; | ||||||||||||||||||||||||||||||||
| 1539 | my @_dl_shared_objects = @DynaLoader::dl_shared_objects; | ||||||||||||||||||||||||||||||||
| 1540 | my @_dl_modules = @DynaLoader::dl_modules; | ||||||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||||||
| 1542 | # save %INC etc so that requires below don't pollute them | ||||||||||||||||||||||||||||||||
| 1543 | my %_INC = %INC; | ||||||||||||||||||||||||||||||||
| 1544 | my @_INC = @INC; | ||||||||||||||||||||||||||||||||
| 1545 | |||||||||||||||||||||||||||||||||
| 1546 | require Cwd; | ||||||||||||||||||||||||||||||||
| 1547 | require Data::Dumper; | ||||||||||||||||||||||||||||||||
| 1548 | require Config; | ||||||||||||||||||||||||||||||||
| 1549 | my $dlext = $Config::Config{dlext}; | ||||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||
| 1551 | foreach my $k (keys %_INC) | ||||||||||||||||||||||||||||||||
| 1552 | { | ||||||||||||||||||||||||||||||||
| 1553 | # NOTES: | ||||||||||||||||||||||||||||||||
| 1554 | # (1) An unsuccessful "require" may store an undefined value into %INC. | ||||||||||||||||||||||||||||||||
| 1555 | # (2) If a key in %INC was located via a CODE or ARRAY ref or | ||||||||||||||||||||||||||||||||
| 1556 | # blessed object in @INC the corresponding value in %INC contains | ||||||||||||||||||||||||||||||||
| 1557 | # the ref from @INC. | ||||||||||||||||||||||||||||||||
| 1558 | # (3) Some modules (e.g. Moose) fake entries in %INC, e.g. | ||||||||||||||||||||||||||||||||
| 1559 | # "Class/MOP/Class/Immutable/Moose/Meta/Class.pm" => "(set by Moose)" | ||||||||||||||||||||||||||||||||
| 1560 | # On some architectures (e.g. Windows) Cwd::abs_path() will throw | ||||||||||||||||||||||||||||||||
| 1561 | # an exception for such a pathname. | ||||||||||||||||||||||||||||||||
| 1562 | |||||||||||||||||||||||||||||||||
| 1563 | my $v = $_INC{$k}; | ||||||||||||||||||||||||||||||||
| 1564 | if (defined $v && !ref $v && -e $v) | ||||||||||||||||||||||||||||||||
| 1565 | { | ||||||||||||||||||||||||||||||||
| 1566 | $_INC{$k} = Cwd::abs_path($v); | ||||||||||||||||||||||||||||||||
| 1567 | } | ||||||||||||||||||||||||||||||||
| 1568 | else | ||||||||||||||||||||||||||||||||
| 1569 | { | ||||||||||||||||||||||||||||||||
| 1570 | delete $_INC{$k}; | ||||||||||||||||||||||||||||||||
| 1571 | } | ||||||||||||||||||||||||||||||||
| 1572 | } | ||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||
| 1574 | # drop refs from @_INC | ||||||||||||||||||||||||||||||||
| 1575 | @_INC = grep { !ref $_ } @_INC; | ||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||
| 1577 | my @dlls = grep { defined $_ && -e $_ } Module::ScanDeps::DataFeed::_dl_shared_objects(); | ||||||||||||||||||||||||||||||||
| 1578 | my @shared_objects = @dlls; | ||||||||||||||||||||||||||||||||
| 1579 | push @shared_objects, grep { -e $_ } map { (my $bs = $_) =~ s/\.\Q$dlext\E$/.bs/; $bs } @dlls; | ||||||||||||||||||||||||||||||||
| 1580 | |||||||||||||||||||||||||||||||||
| 1581 | # write data file | ||||||||||||||||||||||||||||||||
| 1582 | my $data_file = $ENV{MSD_DATA_FILE}; | ||||||||||||||||||||||||||||||||
| 1583 | open my $fh, ">", $data_file | ||||||||||||||||||||||||||||||||
| 1584 | or die "Couldn't open $data_file: $!\n"; | ||||||||||||||||||||||||||||||||
| 1585 | print $fh Data::Dumper::Dumper( | ||||||||||||||||||||||||||||||||
| 1586 | { | ||||||||||||||||||||||||||||||||
| 1587 | '%INC' => \%_INC, | ||||||||||||||||||||||||||||||||
| 1588 | '@INC' => \@_INC, | ||||||||||||||||||||||||||||||||
| 1589 | dl_shared_objects => \@shared_objects, | ||||||||||||||||||||||||||||||||
| 1590 | }); | ||||||||||||||||||||||||||||||||
| 1591 | close $fh; | ||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||
| 1593 | sub Module::ScanDeps::DataFeed::_dl_shared_objects { | ||||||||||||||||||||||||||||||||
| 1594 | if (@_dl_shared_objects) { | ||||||||||||||||||||||||||||||||
| 1595 | return @_dl_shared_objects; | ||||||||||||||||||||||||||||||||
| 1596 | } | ||||||||||||||||||||||||||||||||
| 1597 | elsif (@_dl_modules) { | ||||||||||||||||||||||||||||||||
| 1598 | return map { Module::ScanDeps::DataFeed::_dl_mod2filename($_) } @_dl_modules; | ||||||||||||||||||||||||||||||||
| 1599 | } | ||||||||||||||||||||||||||||||||
| 1600 | return; | ||||||||||||||||||||||||||||||||
| 1601 | } | ||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||
| 1603 | sub Module::ScanDeps::DataFeed::_dl_mod2filename { | ||||||||||||||||||||||||||||||||
| 1604 | my $mod = shift; | ||||||||||||||||||||||||||||||||
| 1605 | |||||||||||||||||||||||||||||||||
| 1606 | return if $mod eq 'B'; | ||||||||||||||||||||||||||||||||
| 1607 | return unless defined &{"$mod\::bootstrap"}; | ||||||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||||||
| 1609 | |||||||||||||||||||||||||||||||||
| 1610 | # cf. DynaLoader.pm | ||||||||||||||||||||||||||||||||
| 1611 | my @modparts = split(/::/, $mod); | ||||||||||||||||||||||||||||||||
| 1612 | my $modfname = defined &DynaLoader::mod2fname ? DynaLoader::mod2fname(\@modparts) : $modparts[-1]; | ||||||||||||||||||||||||||||||||
| 1613 | my $modpname = join('/', @modparts); | ||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||
| 1615 | foreach my $dir (@_INC) { | ||||||||||||||||||||||||||||||||
| 1616 | my $file = "$dir/auto/$modpname/$modfname.$dlext"; | ||||||||||||||||||||||||||||||||
| 1617 | return $file if -e $file; | ||||||||||||||||||||||||||||||||
| 1618 | } | ||||||||||||||||||||||||||||||||
| 1619 | return; | ||||||||||||||||||||||||||||||||
| 1620 | } | ||||||||||||||||||||||||||||||||
| 1621 | } # END or CHECK | ||||||||||||||||||||||||||||||||
| 1622 | ... | ||||||||||||||||||||||||||||||||
| 1623 | |||||||||||||||||||||||||||||||||
| 1624 | # append the file to compile or execute | ||||||||||||||||||||||||||||||||
| 1625 | { | ||||||||||||||||||||||||||||||||
| 1626 | 18 | ▶ | open my $fh, "<", $file or die "Couldn't open $file: $!"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1627 | 18 | print $ih qq[#line 1 "$file"\n], <$fh>; | |||||||||||||||||||||||||||||||
| 1628 | 18 | close $fh; | |||||||||||||||||||||||||||||||
| 1629 | } | ||||||||||||||||||||||||||||||||
| 1630 | 18 | close $ih; | |||||||||||||||||||||||||||||||
| 1631 | |||||||||||||||||||||||||||||||||
| 1632 | # run the instrumented file | ||||||||||||||||||||||||||||||||
| 1633 | my $rc = system( | ||||||||||||||||||||||||||||||||
| 1634 | $^X, | ||||||||||||||||||||||||||||||||
| 1635 | $execute ? () : ("-c"), | ||||||||||||||||||||||||||||||||
| 1636 | 0 | ▶ | (map { "-I$_" } @IncludeLibs), | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 1637 | $instrumented_file, | ||||||||||||||||||||||||||||||||
| 1638 | $execute ? @$execute : ()); | ||||||||||||||||||||||||||||||||
| 1639 | |||||||||||||||||||||||||||||||||
| 1640 | 18 | ▶ | die $execute | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 1641 | ? "SYSTEM ERROR in executing $file @$execute: $rc" | ||||||||||||||||||||||||||||||||
| 1642 | : "SYSTEM ERROR in compiling $file: $rc" | ||||||||||||||||||||||||||||||||
| 1643 | unless $rc == 0; | ||||||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||||||
| 1645 | 18 | ▶ | my $info = do $data_file | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$@ || "can't read ${data_file}: $!"
MC/DC0%0/1
$@ || "can't read ${data_file}: $!"
$@
Truth table0%0/2
A
A= $@
| |||||||||||||||||||||||||||||||||
| 1646 | or die "error extracting info from -c/-x file: ", ($@ || "can't read $data_file: $!"); | ||||||||||||||||||||||||||||||||
| 1647 | |||||||||||||||||||||||||||||||||
| 1648 | 18 | return $info; | |||||||||||||||||||||||||||||||
| 1649 | } | ||||||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||||||
| 1651 | # create a new hashref, applying fixups | ||||||||||||||||||||||||||||||||
| 1652 | 18 | ▶ | sub _info2rv { | ||||||||||||||||||||||||||||||
|
Subroutine
_info2rv: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||
| 1653 | 18 | my ($info) = @_; | |||||||||||||||||||||||||||||||
| 1654 | |||||||||||||||||||||||||||||||||
| 1655 | 18 | my $rv = {}; | |||||||||||||||||||||||||||||||
| 1656 | |||||||||||||||||||||||||||||||||
| 1657 | 224 | my $incs = join('|', sort { length($b) <=> length($a) } | |||||||||||||||||||||||||||||||
| 1658 | 144 | map { s|\\|/|g; s|/+$||; quotemeta($_) } | |||||||||||||||||||||||||||||||
| 1659 | 18 | @{ $info->{'@INC'} }); | |||||||||||||||||||||||||||||||
| 1660 | 18 | my $i = is_insensitive_fs() ? "i" : ""; | |||||||||||||||||||||||||||||||
| 1661 | 18 | my $strip_inc_prefix = qr{^(?$i:$incs)/}; | |||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||
| 1663 | 18 | require File::Spec; | |||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||
| 1665 | 18 | foreach my $key (keys %{ $info->{'%INC'} }) { | |||||||||||||||||||||||||||||||
| 1666 | 1636 | (my $path = $info->{'%INC'}{$key}) =~ s|\\|/|g; | |||||||||||||||||||||||||||||||
| 1667 | |||||||||||||||||||||||||||||||||
| 1668 | # NOTE: %INC may contain (as keys) absolute pathnames, | ||||||||||||||||||||||||||||||||
| 1669 | # e.g. for autosplit .ix and .al files. In the latter case, | ||||||||||||||||||||||||||||||||
| 1670 | # the key may also start with "./" if found via a relative path in @INC. | ||||||||||||||||||||||||||||||||
| 1671 | 1636 | $key =~ s|\\|/|g; | |||||||||||||||||||||||||||||||
| 1672 | 1636 | $key =~ s|^\./||; | |||||||||||||||||||||||||||||||
| 1673 | 1636 | $key =~ s/$strip_inc_prefix//; | |||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||
| 1675 | 1636 | $rv->{$key} = { | |||||||||||||||||||||||||||||||
| 1676 | 'used_by' => [], | ||||||||||||||||||||||||||||||||
| 1677 | 'file' => $path, | ||||||||||||||||||||||||||||||||
| 1678 | 'type' => _gettype($path), | ||||||||||||||||||||||||||||||||
| 1679 | 'key' => $key | ||||||||||||||||||||||||||||||||
| 1680 | }; | ||||||||||||||||||||||||||||||||
| 1681 | } | ||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||
| 1683 | 18 | foreach my $path (@{ $info->{dl_shared_objects} }) { | |||||||||||||||||||||||||||||||
| 1684 | 264 | $path =~ s|\\|/|g; | |||||||||||||||||||||||||||||||
| 1685 | 264 | (my $key = $path) =~ s/$strip_inc_prefix//; | |||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||
| 1687 | 264 | $rv->{$key} = { | |||||||||||||||||||||||||||||||
| 1688 | 'used_by' => [], | ||||||||||||||||||||||||||||||||
| 1689 | 'file' => $path, | ||||||||||||||||||||||||||||||||
| 1690 | 'type' => 'shared', | ||||||||||||||||||||||||||||||||
| 1691 | 'key' => $key | ||||||||||||||||||||||||||||||||
| 1692 | }; | ||||||||||||||||||||||||||||||||
| 1693 | } | ||||||||||||||||||||||||||||||||
| 1694 | |||||||||||||||||||||||||||||||||
| 1695 | 18 | return $rv; | |||||||||||||||||||||||||||||||
| 1696 | } | ||||||||||||||||||||||||||||||||
| 1697 | |||||||||||||||||||||||||||||||||
| 1698 | 3058 | ▶ | sub _gettype { | ||||||||||||||||||||||||||||||
|
Subroutine
_gettype: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||
| 1699 | 3058 | my $name = shift; | |||||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||||||
| 1701 | 3058 | ▶ | return 'autoload' if $name =~ /\.(?:ix|al|bs)$/i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1702 | 2973 | ▶ | return 'module' if $name =~ /\.p[mh]$/i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1703 | 776 | ▶ | return 'shared' if $name =~ /\.\Q$Config{dlext}\E$/i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1704 | 718 | return 'data'; | |||||||||||||||||||||||||||||||
| 1705 | } | ||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||
| 1707 | # merge all keys from $rv_sub into the $rv mega-ref | ||||||||||||||||||||||||||||||||
| 1708 | 18 | ▶ | sub _merge_rv { | ||||||||||||||||||||||||||||||
|
Subroutine
_merge_rv: called CC=5 SCAR=22.9
| |||||||||||||||||||||||||||||||||
| 1709 | 18 | my ($rv_sub, $rv) = @_; | |||||||||||||||||||||||||||||||
| 1710 | |||||||||||||||||||||||||||||||||
| 1711 | 18 | my $key; | |||||||||||||||||||||||||||||||
| 1712 | 18 | foreach $key (keys(%$rv_sub)) { | |||||||||||||||||||||||||||||||
| 1713 | 1900 | my %mark; | |||||||||||||||||||||||||||||||
| 1714 | 1900 | ▶ | if ($rv->{$key} and _not_dup($key, $rv, $rv_sub)) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$rv->{$key} and _not_dup($key, $rv, $rv_sub)
MC/DC0%0/2
$rv->{$key} and _not_dup($key, $rv, $rv_sub)
$rv->{$key}
_not_dup($key, $rv, $rv_sub)
Truth table33%1/3
A and B
A= $rv->{$key}B= _not_dup($key, $rv, $rv_sub)
| |||||||||||||||||||||||||||||||||
| 1715 | warn "Different modules for file '$key' were found.\n" | ||||||||||||||||||||||||||||||||
| 1716 | . " -> Using '" . abs_path($rv_sub->{$key}{file}) . "'.\n" | ||||||||||||||||||||||||||||||||
| 1717 | 0 | . " -> Ignoring '" . abs_path($rv->{$key}{file}) . "'.\n"; | |||||||||||||||||||||||||||||||
| 1718 | $rv->{$key}{used_by} = [ | ||||||||||||||||||||||||||||||||
| 1719 | grep (!$mark{$_}++, | ||||||||||||||||||||||||||||||||
| 1720 | 0 | @{ $rv->{$key}{used_by} }, | |||||||||||||||||||||||||||||||
| 1721 | 0 | @{ $rv_sub->{$key}{used_by} }) | |||||||||||||||||||||||||||||||
| 1722 | ]; | ||||||||||||||||||||||||||||||||
| 1723 | 0 | @{ $rv->{$key}{used_by} } = grep length, @{ $rv->{$key}{used_by} }; | |||||||||||||||||||||||||||||||
| 1724 | 0 | $rv->{$key}{file} = $rv_sub->{$key}{file}; | |||||||||||||||||||||||||||||||
| 1725 | } | ||||||||||||||||||||||||||||||||
| 1726 | elsif ($rv->{$key}) { | ||||||||||||||||||||||||||||||||
| 1727 | $rv->{$key}{used_by} = [ | ||||||||||||||||||||||||||||||||
| 1728 | grep (!$mark{$_}++, | ||||||||||||||||||||||||||||||||
| 1729 | 0 | @{ $rv->{$key}{used_by} }, | |||||||||||||||||||||||||||||||
| 1730 | 0 | @{ $rv_sub->{$key}{used_by} }) | |||||||||||||||||||||||||||||||
| 1731 | ]; | ||||||||||||||||||||||||||||||||
| 1732 | 0 | @{ $rv->{$key}{used_by} } = grep length, @{ $rv->{$key}{used_by} }; | |||||||||||||||||||||||||||||||
| 1733 | } | ||||||||||||||||||||||||||||||||
| 1734 | else { | ||||||||||||||||||||||||||||||||
| 1735 | $rv->{$key} = { | ||||||||||||||||||||||||||||||||
| 1736 | 1900 | used_by => [ @{ $rv_sub->{$key}{used_by} } ], | |||||||||||||||||||||||||||||||
| 1737 | file => $rv_sub->{$key}{file}, | ||||||||||||||||||||||||||||||||
| 1738 | key => $rv_sub->{$key}{key}, | ||||||||||||||||||||||||||||||||
| 1739 | type => $rv_sub->{$key}{type} | ||||||||||||||||||||||||||||||||
| 1740 | 1900 | }; | |||||||||||||||||||||||||||||||
| 1741 | |||||||||||||||||||||||||||||||||
| 1742 | 1900 | @{ $rv->{$key}{used_by} } = grep length, @{ $rv->{$key}{used_by} }; | |||||||||||||||||||||||||||||||
| 1743 | } | ||||||||||||||||||||||||||||||||
| 1744 | } | ||||||||||||||||||||||||||||||||
| 1745 | } | ||||||||||||||||||||||||||||||||
| 1746 | |||||||||||||||||||||||||||||||||
| 1747 | 0 | ▶ | sub _not_dup { | ||||||||||||||||||||||||||||||
|
Subroutine
_not_dup: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 1748 | 0 | my ($key, $rv1, $rv2) = @_; | |||||||||||||||||||||||||||||||
| 1749 | 0 | if (is_insensitive_fs) { | |||||||||||||||||||||||||||||||
| 1750 | return lc(abs_path($rv1->{$key}{file})) ne lc(abs_path($rv2->{$key}{file})); | ||||||||||||||||||||||||||||||||
| 1751 | } | ||||||||||||||||||||||||||||||||
| 1752 | else { | ||||||||||||||||||||||||||||||||
| 1753 | 0 | return abs_path($rv1->{$key}{file}) ne abs_path($rv2->{$key}{file}); | |||||||||||||||||||||||||||||||
| 1754 | } | ||||||||||||||||||||||||||||||||
| 1755 | } | ||||||||||||||||||||||||||||||||
| 1756 | |||||||||||||||||||||||||||||||||
| 1757 | 0 | ▶ | sub _warn_of_runtime_loader { | ||||||||||||||||||||||||||||||
|
Subroutine
_warn_of_runtime_loader: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 1758 | 0 | my $module = shift; | |||||||||||||||||||||||||||||||
| 1759 | 0 | ▶ | return if $SeenRuntimeLoader{$module}++; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1760 | 0 | $module =~ s/\.pm$//; | |||||||||||||||||||||||||||||||
| 1761 | 0 | $module =~ s|/|::|g; | |||||||||||||||||||||||||||||||
| 1762 | 0 | warn "# Use of runtime loader module $module detected. Results of static scanning may be incomplete.\n"; | |||||||||||||||||||||||||||||||
| 1763 | 0 | return; | |||||||||||||||||||||||||||||||
| 1764 | } | ||||||||||||||||||||||||||||||||
| 1765 | |||||||||||||||||||||||||||||||||
| 1766 | 138 | ▶ | sub _warn_of_missing_module { | ||||||||||||||||||||||||||||||
|
Subroutine
_warn_of_missing_module: called CC=4 SCAR=20.9
| |||||||||||||||||||||||||||||||||
| 1767 | 138 | my $module = shift; | |||||||||||||||||||||||||||||||
| 1768 | 138 | my $warn = shift; | |||||||||||||||||||||||||||||||
| 1769 | 138 | ▶ | return if not $warn; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1770 | 0 | ▶ | return if not $module =~ /\.p[ml]$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1771 | 0 | ▶ | warn "# Could not find source file '$module' in \@INC or \@IncludeLibs. Skipping it.\n" | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1772 | if not -f $module; | ||||||||||||||||||||||||||||||||
| 1773 | } | ||||||||||||||||||||||||||||||||
| 1774 | |||||||||||||||||||||||||||||||||
| 1775 | 5702 | ▶ | sub _get_preload1 { | ||||||||||||||||||||||||||||||
|
Subroutine
_get_preload1: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||
| 1776 | 5702 | my $pm = shift; | |||||||||||||||||||||||||||||||
| 1777 | 5702 | ▶ | my $preload = $Preload{$pm} or return(); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1778 | 117 | ▶ | if ($preload eq 'sub') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 1779 | 18 | $pm =~ s/\.p[mh]$//i; | |||||||||||||||||||||||||||||||
| 1780 | 18 | return _glob_in_inc($pm, 1); | |||||||||||||||||||||||||||||||
| 1781 | } | ||||||||||||||||||||||||||||||||
| 1782 | elsif (UNIVERSAL::isa($preload, 'CODE')) { | ||||||||||||||||||||||||||||||||
| 1783 | 58 | return $preload->($pm); | |||||||||||||||||||||||||||||||
| 1784 | } | ||||||||||||||||||||||||||||||||
| 1785 | 41 | return @$preload; | |||||||||||||||||||||||||||||||
| 1786 | } | ||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||
| 1788 | 5702 | ▶ | sub _get_preload { | ||||||||||||||||||||||||||||||
|
Subroutine
_get_preload: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||
| 1789 | 5702 | my ($pm, $seen) = @_; | |||||||||||||||||||||||||||||||
| 1790 | 5702 | ▶ | $seen ||= {}; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$seen ||= {}
MC/DC100%1/1
$seen ||= {}
$seen
Truth table100%2/2
A
A= $seen
| |||||||||||||||||||||||||||||||||
| 1791 | 5702 | $seen->{$pm}++; | |||||||||||||||||||||||||||||||
| 1792 | 5702 | my @preload; | |||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||
| 1794 | 5702 | foreach $pm (_get_preload1($pm)) | |||||||||||||||||||||||||||||||
| 1795 | { | ||||||||||||||||||||||||||||||||
| 1796 | 4856 | ▶ | next if $seen->{$pm}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1797 | 2989 | $seen->{$pm}++; | |||||||||||||||||||||||||||||||
| 1798 | 2989 | push @preload, $pm, _get_preload($pm, $seen); | |||||||||||||||||||||||||||||||
| 1799 | } | ||||||||||||||||||||||||||||||||
| 1800 | 5702 | return @preload; | |||||||||||||||||||||||||||||||
| 1801 | } | ||||||||||||||||||||||||||||||||
| 1802 | |||||||||||||||||||||||||||||||||
| 1803 | 19 | 1; | |||||||||||||||||||||||||||||||
| 1804 | __END__ | ||||||||||||||||||||||||||||||||