File Coverage

blib/lib/Locale/India.pm
Criterion Covered Total %
statement 11 13 84.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 16 18 88.8


line stmt bran cond sub pod time code
1             package Locale::India;
2              
3             BEGIN {
4 1     1   29637 $Locale::India::VERSION = '0.001';
5             }
6              
7              
8 1     1   9 use strict;
  1         2  
  1         21  
9 1     1   5 use warnings;
  1         2  
  1         28  
10              
11 1     1   953 use Data::Dumper;
  1         13994  
  1         133  
12              
13 1     1   22978 use Data::Section::Simple;
  0            
  0            
14              
15             # Constructor
16              
17             sub new {
18              
19             my $class = shift;
20             my $self = {} ;
21              
22             my $data = Data::Section::Simple::get_data_section('states');
23              
24             my @line = split "\n", $data;
25              
26             foreach ( @line ) {
27              
28             my ($code, $name, $type) = split ':';
29              
30             if ($type =~ /state/i) {
31             $self->{code2state}{uc $code} = uc $name;
32             $self->{state2code}{uc $name} = uc $code;
33             } else {
34             $self->{code2ut}{uc $code} = uc $name;
35             $self->{ut2code}{uc $name} = uc $code;
36             }
37             }
38              
39             bless $self, $class;
40             }
41              
42             sub get_all_state_codes {
43              
44             my $self = shift;
45              
46             sort keys % { $self->{code2state} } ;
47              
48             }
49              
50             sub get_all_state_names {
51              
52             my $self = shift;
53              
54             sort keys % { $self->{state2code} } ;
55              
56             }
57              
58             sub get_all_ut_codes {
59              
60             my $self = shift;
61              
62             sort keys % { $self->{code2ut} };
63              
64             }
65              
66             sub get_all_ut_names {
67              
68             my $self = shift;
69              
70             sort keys % { $self->{ut2code} };
71              
72             }
73              
74             1;
75              
76             __DATA__