line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geography::BrazilianStates; |
2
|
2
|
|
|
2
|
|
32356
|
use 5.008001; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
124
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
79
|
|
4
|
2
|
|
|
2
|
|
21
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
1608
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $STATES = [ |
9
|
|
|
|
|
|
|
{name => 'Acre', abbreviation => 'AC', capital => 'Rio Branco', region => 'Norte'}, |
10
|
|
|
|
|
|
|
{name => 'Alagoas', abbreviation => 'AL', capital => 'Maceió', region => 'Nordeste'}, |
11
|
|
|
|
|
|
|
{name => 'Amapá', abbreviation => 'AP', capital => 'Macapá', region => 'Norte'}, |
12
|
|
|
|
|
|
|
{name => 'Amazonas', abbreviation => 'AM', capital => 'Manaus', region => 'Norte'}, |
13
|
|
|
|
|
|
|
{name => 'Bahia', abbreviation => 'BA', capital => 'Salvador', region => 'Nordeste'}, |
14
|
|
|
|
|
|
|
{name => 'Ceará', abbreviation => 'CE', capital => 'Fortaleza', region => 'Nordeste'}, |
15
|
|
|
|
|
|
|
{name => 'Distrito Federal', abbreviation => 'DF', capital => 'Brasília', region => 'Centro-Oeste'}, |
16
|
|
|
|
|
|
|
{name => 'Espírito Santo', abbreviation => 'ES', capital => 'Vitória', region => 'Sudeste'}, |
17
|
|
|
|
|
|
|
{name => 'Goiás', abbreviation => 'GO', capital => 'Goiânia', region => 'Centro-Oeste'}, |
18
|
|
|
|
|
|
|
{name => 'Maranhão', abbreviation => 'MA', capital => 'São Luís', region => 'Nordeste'}, |
19
|
|
|
|
|
|
|
{name => 'Mato Grosso', abbreviation => 'MT', capital => 'Cuiabá', region => 'Centro-Oeste'}, |
20
|
|
|
|
|
|
|
{name => 'Mato Grosso do Sul', abbreviation => 'MS', capital => 'Campo Grande', region => 'Centro-Oeste'}, |
21
|
|
|
|
|
|
|
{name => 'Minas Gerais', abbreviation => 'MG', capital => 'Belo Horizonte', region => 'Sudeste'}, |
22
|
|
|
|
|
|
|
{name => 'Pará', abbreviation => 'PA', capital => 'Belém', region => 'Norte'}, |
23
|
|
|
|
|
|
|
{name => 'Paraíba', abbreviation => 'PB', capital => 'João Pessoa', region => 'Nordeste'}, |
24
|
|
|
|
|
|
|
{name => 'Paraná', abbreviation => 'PR', capital => 'Curitiba', region => 'Sul'}, |
25
|
|
|
|
|
|
|
{name => 'Pernambuco', abbreviation => 'PE', capital => 'Recife', region => 'Nordeste'}, |
26
|
|
|
|
|
|
|
{name => 'Piauí', abbreviation => 'PI', capital => 'Teresina', region => 'Nordeste'}, |
27
|
|
|
|
|
|
|
{name => 'Rio de Janeiro', abbreviation => 'RJ', capital => 'Rio de Janeiro', region => 'Sudeste'}, |
28
|
|
|
|
|
|
|
{name => 'Rio Grande do Norte', abbreviation => 'RN', capital => 'Natal', region => 'Nordeste'}, |
29
|
|
|
|
|
|
|
{name => 'Rio Grande do Sul', abbreviation => 'RS', capital => 'Porto Alegre', region => 'Sul'}, |
30
|
|
|
|
|
|
|
{name => 'Rondônia', abbreviation => 'RO', capital => 'Porto Velho', region => 'Norte'}, |
31
|
|
|
|
|
|
|
{name => 'Roraima', abbreviation => 'RR', capital => 'Boa Vista', region => 'Norte'}, |
32
|
|
|
|
|
|
|
{name => 'Santa Catarina', abbreviation => 'SC', capital => 'Florianópolis', region => 'Sul'}, |
33
|
|
|
|
|
|
|
{name => 'São Paulo', abbreviation => 'SP', capital => 'São Paulo', region => 'Sudeste'}, |
34
|
|
|
|
|
|
|
{name => 'Sergipe', abbreviation => 'SE', capital => 'Aracaju', region => 'Nordeste'}, |
35
|
|
|
|
|
|
|
{name => 'Tocantins', abbreviation => 'TO', capital => 'Palmas', region => 'Norte'} |
36
|
|
|
|
|
|
|
]; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub states { |
39
|
1
|
|
|
1
|
1
|
1853
|
my $class = shift; |
40
|
1
|
|
|
|
|
10
|
return map { $_->{name} } @$STATES; |
|
27
|
|
|
|
|
84
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub abbreviations { |
44
|
1
|
|
|
1
|
1
|
2307
|
my $class = shift; |
45
|
1
|
|
|
|
|
4
|
return map { $_->{abbreviation} } @$STATES; |
|
27
|
|
|
|
|
56
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub capitals { |
49
|
1
|
|
|
1
|
1
|
1611
|
my $class = shift; |
50
|
1
|
|
|
|
|
5
|
return map { $_->{capital} } @$STATES; |
|
27
|
|
|
|
|
54
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub regions { |
54
|
1
|
|
|
1
|
1
|
1605
|
my $class = shift; |
55
|
1
|
|
|
|
|
4
|
my %uniq; |
56
|
1
|
|
|
|
|
3
|
return grep { !$uniq{$_}++ } map { $_->{region} } @$STATES; |
|
27
|
|
|
|
|
61
|
|
|
27
|
|
|
|
|
46
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub abbreviation { |
60
|
2
|
|
|
2
|
1
|
2136
|
my ($class, $name) = @_; |
61
|
2
|
|
|
|
|
8
|
for my $state(@$STATES) { |
62
|
8
|
100
|
|
|
|
34
|
if ($name eq $state->{name}) { |
|
|
100
|
|
|
|
|
|
63
|
1
|
|
|
|
|
6
|
return $state->{abbreviation}; |
64
|
|
|
|
|
|
|
} elsif ($name eq $state->{abbreviation}) { |
65
|
1
|
|
|
|
|
7
|
return $state->{name}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub capital { |
71
|
2
|
|
|
2
|
1
|
2105
|
my ($class, $name) = @_; |
72
|
2
|
|
|
|
|
9
|
for my $state(@$STATES) { |
73
|
8
|
100
|
|
|
|
33
|
if ($name eq $state->{name}) { |
|
|
100
|
|
|
|
|
|
74
|
1
|
|
|
|
|
6
|
return $state->{capital}; |
75
|
|
|
|
|
|
|
} elsif ($name eq $state->{capital}) { |
76
|
1
|
|
|
|
|
6
|
return $state->{name}; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub region { |
82
|
2
|
|
|
2
|
1
|
2241
|
my ($class, $name) = @_; |
83
|
2
|
|
|
|
|
7
|
my $regions = []; |
84
|
2
|
|
|
|
|
8
|
for my $state(@$STATES) { |
85
|
31
|
100
|
|
|
|
107
|
if ($name eq $state->{name}) { |
|
|
100
|
|
|
|
|
|
86
|
1
|
|
|
|
|
7
|
return $state->{region}; |
87
|
|
|
|
|
|
|
} elsif ($name eq $state->{region}) { |
88
|
7
|
|
|
|
|
19
|
push @$regions, $state->{name}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
1
|
|
|
|
|
9
|
return @$regions; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub states_all { |
95
|
1
|
|
|
1
|
1
|
1714
|
my $class = shift; |
96
|
1
|
|
|
|
|
4
|
return $STATES; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
__END__ |