blib/lib/Devel/Loaded.pm

filter: Statementstmt 0.0% 0 / 12 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 23 CC 7 SCAR 39.0
CC
7
Cov
0%
END
56.0
DB
2.0
CRAP 49.2
↑ Summary bin/pminst »
1 # Loaded.pm -- show what files were loaded
2 package Devel::Loaded;
3  
4 # ABSTRACT: pmtools - Perl Module Tools
5  
6 # ------ pragmas
7 use strict;
8 use warnings;
9 use File::Spec;
10  
11 our $VERSION = '2.2.0';
12  
13 # ----- define variable
14 my $path = undef; # current module path
15 our %Seen = (); # track whether we've seen this module before
16  
17 BEGIN {
18 %Seen = %INC;
19  
20 0 ▶ sub DB::DB { 1 }
Subroutine DB: not called CC=1 SCAR=6.9
Pod undocumented
21 }
22  
23  
24 END {
25 # get last part of Devel::Loaded path; handle File::Spec->canonpath() removing '.' from '.pm'
26 0 ▶ my $devel_loaded = File::Spec->catfile('Devel', 'Loaded.pm');
Subroutine END: not called CC=7 SCAR=40.3
27 0 ▶ if ($devel_loaded =~ m/Loadedpm$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($devel_loaded =~ /Loadedpm$/) 0 0 0
28 0 $devel_loaded =~ s/Loadedpm$/Loaded.pm/;
29 }
30  
31 # delete the matching absolute path from %INC
32 # NOTE: this will fail if you also have directories like ".../MyOwnDevel/Loaded.pm"
33 0 my $inc_devel_loaded = "";
34 0 foreach $path (keys(%INC)) {
35 0 ▶ if ($path =~ m/$devel_loaded$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ /$devel_loaded$/) 0 0 0
36 0 $inc_devel_loaded = $path;
37 0 last;
38 }
39 }
40 0 ▶ if ($inc_devel_loaded ne "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($inc_devel_loaded ne "") 0 0 0
41 #delete $INC{$inc_devel_loaded};
42 }
43  
44 0 for my $path (values %INC) {
45 0 ▶ print "$path\n" unless $Seen{$path};
Branch: 1 branch
BranchTrueFalseTotal
unless $Devel::Loaded::Seen{$path} 0 0 0
46 }
47  
48 }
49  
50 1;
51  
52 __END__
↑ Summary bin/pminst »