File Coverage

blib/lib/Lingua/EN/Numbers/Easy.pm
Criterion Covered Total %
statement 28 34 82.3
branch 7 8 87.5
condition n/a
subroutine 8 14 57.1
pod n/a
total 43 56 76.7


line stmt bran cond sub pod time code
1             package Lingua::EN::Numbers::Easy;
2              
3 1     1   442 use strict;
  1         1  
  1         31  
4 1     1   4 use warnings;
  1         1  
  1         23  
5 1     1   3 no warnings 'syntax';
  1         3  
  1         54  
6              
7             our $VERSION = '2014120401';
8             our %N;
9              
10 1     1   549 use Lingua::EN::Numbers 1.01 qw [num2en];
  1         2180  
  1         119  
11              
12             sub import {
13 2 100   2   29 my ($pkg, $hash) = grep {$_ ne 'American' and
  4         24  
14             $_ ne 'British'} @_;
15            
16 2         3 my $callpkg = caller;
17 2 100       6 $hash = 'N' unless defined $hash;
18 2         8 $hash =~ s/^%//;
19              
20 1     1   6 no strict 'refs';
  1         1  
  1         171  
21 2         4 *{"${callpkg}::$hash"} = \%N;
  2         1399  
22             }
23              
24              
25 1     1   12 sub TIEHASH {bless {0 => 'zero'} => __PACKAGE__}
26             sub FETCH {
27 12     12   120 my $self = shift;
28 12         10 my $value = shift;
29 12 100       28 return $self -> {$value} if exists $self -> {$value};
30 10 50       17 my $n = num2en ($value) or return;
31 10         280 $self -> {$value} = lc $n;
32             }
33              
34 0     0     sub STORE {die}
35 0     0     sub EXISTS {die}
36 0     0     sub DELETE {die}
37 0     0     sub CLEAR {die}
38 0     0     sub FIRSTKEY {die}
39 0     0     sub NEXTKEY {die}
40              
41             tie %N => __PACKAGE__;
42              
43             __END__