File Coverage

blib/lib/rperlnamespaces.pm
Criterion Covered Total %
statement 12 41 29.2
branch 0 8 0.0
condition 0 21 0.0
subroutine 4 8 50.0
pod 0 4 0.0
total 16 82 19.5


line stmt bran cond sub pod time code
1             ## no critic qw(Capitalization ProhibitMultiplePackages ProhibitReusedNames) # SYSTEM DEFAULT 3: allow multiple & lower case package names
2             package # hide from PAUSE indexing
3             rperlnamespaces;
4 9     9   55 use strict;
  9         23  
  9         222  
5 9     9   43 use warnings;
  9         18  
  9         206  
6 9     9   3230 use rperlnamespaces_generated;
  9         49  
  9         364  
7             our $VERSION = 0.002_000;
8              
9 9     9   62 use Data::Dumper;
  9         23  
  9         2747  
10              
11             sub array {
12 0     0 0   my $namespaces = [];
13 0           for my $name ( sort keys %main:: ) {
14 0           my $glob = $main::{$name};
15 0 0 0       if ( (not ref $glob) and %{$glob} ) { # check glob ref to avoid "not a HASH reference" error on DUMMY code refs
  0            
16 0           push @{$namespaces}, $name;
  0            
17             }
18             }
19 0           return $namespaces;
20             }
21              
22             sub hash {
23             # print 'in rperlnamespaces::hash(), top of subroutine', "\n";
24 0     0 0   my $namespaces = {};
25 0           for my $name ( sort keys %main:: ) {
26 0           my $glob = $main::{$name};
27             # print 'in rperlnamespaces::hash(), have ref $glob = ', ref $glob, "\n";
28             # print 'in rperlnamespaces::hash(), have $glob = ', Dumper($glob), "\n";
29 0 0 0       if ( (not ref $glob) and %{$glob} ) { # check glob ref to avoid "not a HASH reference" error on DUMMY code refs
  0            
30 0           $namespaces->{$name} = 1;
31             }
32             }
33             # print 'in rperlnamespaces::hash(), bottom of subroutine, about to return $namespaces = ', Dumper($namespaces), "\n";
34 0           return $namespaces;
35             }
36              
37             sub hash_noncore {
38             # print 'in hash_noncore(), have $rperlnamespaces_generated::CORE = ' . Dumper($rperlnamespaces_generated::CORE) . "\n";
39 0     0 0   my $namespaces = {};
40 0           for my $name ( sort keys %main:: ) {
41 0           my $glob = $main::{$name};
42 0 0 0       if ( (not ref $glob) and %{$glob} # check glob ref to avoid "not a HASH reference" error on DUMMY code refs
  0   0        
43             and ( not exists $rperlnamespaces_generated::CORE->{$name} ) )
44             {
45 0           $namespaces->{$name} = 1;
46             }
47             }
48 0           return $namespaces;
49             }
50              
51             sub hash_noncore_nonrperl {
52             # print 'in hash_noncore(), have $rperlnamespaces_generated::CORE = ' . Dumper($rperlnamespaces_generated::CORE) . "\n";
53 0     0 0   my $namespaces = {};
54 0           for my $name ( sort keys %main:: ) {
55 0           my $glob = $main::{$name};
56 0 0 0       if ( (not ref $glob) and %{$glob} # check glob ref to avoid "not a HASH reference" error on DUMMY code refs
  0   0        
      0        
57             and ( not exists $rperlnamespaces_generated::CORE->{$name} )
58             and ( not exists $rperlnamespaces_generated::RPERL->{$name} ) )
59             {
60 0           $namespaces->{$name} = 1;
61             }
62             }
63 0           return $namespaces;
64             }
65              
66             1;