blib/lib/Locale/India.pm

filter: Statementstmt 84.6% 11 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 88.8% 16 / 18 CC 1 SCAR 0.6
CC
1
Cov
85%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package Locale::India;
2  
3 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 $Locale::India::VERSION = '0.001';
5 }
6  
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶use Data::Section::Simple;
Subroutine BEGIN: called CC=1 SCAR=2.6
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__
↑ Summary