File Coverage

blib/lib/Acme/Innuendo.pm
Criterion Covered Total %
statement 20 29 68.9
branch 1 8 12.5
condition 1 4 25.0
subroutine 7 9 77.7
pod 4 4 100.0
total 33 54 61.1


line stmt bran cond sub pod time code
1             package Acme::Innuendo;
2            
3 1     1   718 use 5.006001;
  1         3  
  1         36  
4 1     1   5 use strict;
  1         1  
  1         30  
5 1     1   30 use warnings;
  1         2  
  1         140  
6            
7             require Exporter::Lite;
8            
9             our @ISA = qw(Exporter::Lite);
10            
11             our @EXPORT_OK = ( );
12            
13             our @EXPORT = qw(
14             special_place nudge_nudge wink_wink walk_the_dog
15             );
16            
17             our $VERSION = '0.03';
18             $VERSION = eval $VERSION; # see L
19            
20             sub special_place {
21 4   50 4 1 452 my $namespace = shift || 'main';
22 4 50       11 if (defined $namespace) {
23 4         6 $namespace .= '::';
24             }
25 1     1   4 no strict 'refs';
  1         1  
  1         236  
26 4         18 return *$namespace;
27             }
28            
29             sub nudge_nudge {
30 1     1 1 5 my ($root, $sym, $value) = @_;
31 1         5 $root->{$sym} = $value;
32             }
33            
34             sub wink_wink {
35 3     3 1 7 my ($root, $sym) = @_;
36 3         20 return $root->{$sym};
37             }
38            
39            
40             sub walk_the_dog {
41 0     0 1   my $root = shift;
42 0   0 0     my $callback = shift || sub { };
  0            
43            
44 0 0         return unless ($root);
45            
46 0           foreach my $sym (keys %$root) {
47 0           my $ref = $root->{$sym};
48 0 0         if ($sym =~ m/::$/) {
49 0 0         walk_the_dog($ref, $callback), if ($sym ne 'main::');
50             }
51             else {
52 0           &$callback($root,$sym,$ref);
53             }
54             }
55             }
56            
57            
58             1;
59             __END__