File Coverage

blib/lib/English/Reference.pm
Criterion Covered Total %
statement 19 21 90.4
branch n/a
condition n/a
subroutine 8 9 88.8
pod 0 5 0.0
total 27 35 77.1


line stmt bran cond sub pod time code
1             package English::Reference;
2              
3 1     1   611 use strict;
  1         1  
  1         38  
4 1     1   5 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
  1         2  
  1         224  
5              
6             require Exporter;
7              
8             @ISA = qw(Exporter);
9             # Items to export into callers namespace by default. Note: do not export
10             # names by default without a very good reason. Use EXPORT_OK instead.
11             # Do not simply export all your public functions/methods/constants.
12             @EXPORT = qw(
13             ARRAY CODE GLOB HASH SCALAR
14             );
15             @EXPORT_OK = qw(
16             deref
17             );
18              
19             $VERSION = '0.01';
20              
21             #bootstrap English::Reference $VERSION;
22              
23             sub ARRAY($) {
24 1     1 0 84 return @{ shift() };
  1         6  
25             }
26             sub CODE($) {
27 1     1 0 27 return &{ shift() };
  1         6  
28             }
29             sub GLOB($) {
30 1     1 0 30 return *{ shift() };
  1         5  
31             }
32             sub HASH($) {
33 1     1 0 27 return %{ shift() };
  1         10  
34             }
35             sub SCALAR($) {
36 2     2   72 return ${ shift() };
  2         9  
37             }
38              
39             sub deref($) {
40 1     1   6 no strict qw(refs);
  1         12  
  1         65  
41 0     0 0   return &{ref($_[0])}($_[0]);
  0            
42             }
43              
44             1;
45             __END__