blib/lib/perltypesnamespaces.pm untested

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