File Coverage

blib/lib/Locale/US.pm
Criterion Covered Total %
statement 22 28 78.5
branch n/a
condition n/a
subroutine 6 8 75.0
pod 2 3 66.6
total 30 39 76.9


line stmt bran cond sub pod time code
1             package Locale::US;
2             BEGIN {
3 1     1   6876 $Locale::US::VERSION = '3.03';
4             }
5              
6 1     1   7 use strict;
  1         2  
  1         18  
7 1     1   5 use warnings;
  1         1  
  1         31  
8              
9 1     1   939 use Data::Dumper;
  1         9458  
  1         53  
10              
11 1     1   689 use Data::Section::Simple;
  1         501  
  1         228  
12              
13             # Preloaded methods go here.
14              
15             sub new {
16            
17 1     1 0 495 my $class = shift;
18 1         2 my $self = {} ;
19              
20 1         8 my $data = Data::Section::Simple::get_data_section('states');
21             #die "data: $data";
22              
23 1         268 my @line = split "\n", $data;
24             #die "LINE: @line";
25              
26 1         3 for ( @line ) {
27              
28 59         110 my ($code, $state) = split ':';
29             #warn " my ($code, $state) = split ':';";
30              
31 59         130 $self->{code2state}{$code} = $state;
32 59         126 $self->{state2code}{$state} = $code;
33             }
34              
35             #die Dumper $self;
36 1         7 bless $self, $class;
37             }
38              
39             sub all_state_codes {
40              
41 0     0 1   my $self = shift;
42              
43 0           sort keys % { $self->{code2state} } ;
  0            
44              
45             }
46              
47             sub all_state_names {
48              
49 0     0 1   my $self = shift;
50              
51 0           sort keys % { $self->{state2code} } ;
  0            
52              
53             }
54              
55             1;
56              
57             __DATA__