/usr/share/perl5/Locale/US.pm is in liblocale-us-perl 3.04-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | package Locale::US;
BEGIN {
$Locale::US::VERSION = '3.04';
}
use strict;
use warnings;
use Data::Dumper;
use Data::Section::Simple;
# Preloaded methods go here.
sub new {
my $class = shift;
my $self = {} ;
my $data = Data::Section::Simple::get_data_section('states');
#die "data: $data";
my @line = split "\n", $data;
#die "LINE: @line";
for ( @line ) {
my ($code, $state) = split ':';
#warn " my ($code, $state) = split ':';";
$self->{code2state}{$code} = $state;
$self->{state2code}{$state} = $code;
}
#die Dumper $self;
bless $self, $class;
}
sub all_state_codes {
my $self = shift;
sort keys % { $self->{code2state} } ;
}
sub all_state_names {
my $self = shift;
sort keys % { $self->{state2code} } ;
}
1;
__DATA__
@@ states
AL:ALABAMA
AK:ALASKA
AS:AMERICAN SAMOA
AZ:ARIZONA
AR:ARKANSAS
CA:CALIFORNIA
CO:COLORADO
CT:CONNECTICUT
DE:DELAWARE
DC:DISTRICT OF COLUMBIA
FM:FEDERATED STATES OF MICRONESIA
FL:FLORIDA
GA:GEORGIA
GU:GUAM
HI:HAWAII
ID:IDAHO
IL:ILLINOIS
IN:INDIANA
IA:IOWA
KS:KANSAS
KY:KENTUCKY
LA:LOUISIANA
ME:MAINE
MH:MARSHALL ISLANDS
MD:MARYLAND
MA:MASSACHUSETTS
MI:MICHIGAN
MN:MINNESOTA
MS:MISSISSIPPI
MO:MISSOURI
MT:MONTANA
NE:NEBRASKA
NV:NEVADA
NH:NEW HAMPSHIRE
NJ:NEW JERSEY
NM:NEW MEXICO
NY:NEW YORK
NC:NORTH CAROLINA
ND:NORTH DAKOTA
MP:NORTHERN MARIANA ISLANDS
OH:OHIO
OK:OKLAHOMA
OR:OREGON
PW:PALAU
PA:PENNSYLVANIA
PR:PUERTO RICO
RI:RHODE ISLAND
SC:SOUTH CAROLINA
SD:SOUTH DAKOTA
TN:TENNESSEE
TX:TEXAS
UT:UTAH
VT:VERMONT
VI:VIRGIN ISLANDS
VA:VIRGINIA
WA:WASHINGTON
WV:WEST VIRGINIA
WI:WISCONSIN
WY:WYOMING
__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
Locale::US - Two letter codes for state identification in the United States and vice versa.
=head1 SYNOPSIS
use Locale::US;
my $u = Locale::US->new;
my $state = $u->{code2state}{$code};
my $code = $u->{state2code}{$state};
my @state = $u->all_state_names;
my @code = $u->all_state_codes;
=head1 ABSTRACT
Map from US two-letter codes to states and vice versa.
=head1 DESCRIPTION
=head2 MAPPING
=head3 $self->{code2state}
This is a hashref which has two-letter state names as the key and the long name as the value.
=head3 $self->{state2code}
This is a hashref which has the long nameas the key and the two-letter state name as the value.
=head2 DUMPING
=head3 $self->all_state_names
Returns an array (not arrayref) of all state names in alphabetical form
=head3 $self->all_state_codes
Returns an array (not arrayref) of all state codes in alphabetical form.
=head1 KNOWN BUGS AND LIMITATIONS
=over 4
=item * The state name is returned in C<uc()> format.
=item * neither hash is strict, though they should be.
=back
=head1 SEE ALSO
=head2 Locale::Country
L<Locale::Country>
=head2 Abbreviations
L<http://www.usps.gov/ncsc/lookups/usps_abbreviations.htm>
Online file with the USPS two-letter codes for the United States and its possessions.
=head2 AUXILIARY CODE:
lynx -dump http://www.usps.gov/ncsc/lookups/usps_abbreviations.htm > kruft.txt
kruft2codes.pl
=head1 AUTHOR
Currently maintained by Mike Accardo, <accardo@cpan.org>
Original author T. M. Brannon
=head2 PATCHES
Thanks to stevet AT ibrinc for a patch about second call to new failing.
=head1 COPYRIGHT
Copyright (c) 2015 Mike Accardo
Copyright (c) 2002-2014 Terrence Brannon
All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
|