1Geography::Countries(3)User Contributed Perl DocumentatioGneography::Countries(3)
2
3
4

NAME

6       Geography::Countries - 2-letter, 3-letter, and numerical codes for
7       countries.
8

SYNOPSIS

10           use Geography::Countries;
11
12           $country = country 'DE';  # 'Germany'
13           @list    = country  666;  # ('PM', 'SPM', 666,
14                                     #  'Saint Pierre and Miquelon', 1)
15

DESCRIPTION

17       This module maps country names, and their 2-letter, 3-letter and
18       numerical codes, as defined by the ISO-3166 maintenance agency [1], and
19       defined by the UNSD.
20
21   The "country" subroutine.
22       This subroutine is exported by default. It takes a 2-letter, 3-letter
23       or numerical code, or a country name as argument. In scalar context, it
24       will return the country name, in list context, it will return a list
25       consisting of the 2-letter code, the 3-letter code, the numerical code,
26       the country name, and a flag, which is explained below. Note that not
27       all countries have all 3 codes; if a code is unknown, the undefined
28       value is returned.
29
30       There are 3 categories of countries. The largest category are the
31       current countries. Then there is a small set of countries that no
32       longer exist. The final set consists of areas consisting of multiple
33       countries, like Africa. No 2-letter or 3-letter codes are available for
34       the second two sets. (ISO 3166-3 [3] defines 4 letter codes for the set
35       of countries that no longer exist, but the author of this module was
36       unable to get her hands on that standard.) By default, "country" only
37       returns countries from the first set, but this can be changed by giving
38       "country" an optional second argument.
39
40       The module optionally exports the constants "CNT_F_REGULAR",
41       "CNT_F_OLD", "CNT_F_REGION" and "CNT_F_ANY". These constants can also
42       be important all at once by using the tag ":FLAGS". "CNT_F_ANY" is just
43       the binary or of the three other flags. The second argument of
44       "country" should be the binary or of a subset of the flags
45       "CNT_F_REGULAR", "CNT_F_OLD", and "CNT_F_REGION" - if no, or a false,
46       second argument is given, "CNT_F_REGULAR" is assumed. If
47       "CNT_F_REGULAR" is set, regular (current) countries will be returned;
48       if "CNT_F_OLD" is set, old, no longer existing, countries will be
49       returned, while "CNT_F_REGION" is used in case a region (not
50       necessarely) a country might be returned.  If "country" is used in list
51       context, the fifth returned element is one of "CNT_F_REGULAR",
52       "CNT_F_OLD" and "CNT_F_REGION", indicating whether the result is a
53       regular country, an old country, or a region.
54
55       In list context, "country" returns a 5 element list. To avoid having to
56       remember which element is in which index, the constants "CNT_I_CODE2",
57       "CNT_I_CODE3", "CNT_I_NUMCODE", "CNT_I_COUNTRY" and "CNT_I_FLAG" can be
58       imported. Those constants contain the indices of the 2-letter code, the
59       3-letter code, the numerical code, the country, and the flag explained
60       above, respectively. All index constants can be imported by using the
61       ":INDICES" tag.
62
63   The "code2", "code3", "numcode" and "countries" routines.
64       All known 2-letter codes, 3-letter codes, numerical codes and country
65       names can be returned by the routines "code2", "code3", "numcode" and
66       "countries". None of these methods is exported by default; all need to
67       be imported if one wants to use them. The tag ":LISTS" imports them
68       all. In scalar context, the number of known codes or countries is
69       returned.
70

REFERENCES

72       The 2-letter codes come from the ISO 3166-1:1997 standard [2]. ISO 3166
73       bases its list of country names on the list of names published by the
74       United Nations. This list is published by the Statistical Division of
75       the United Nations [4]. The UNSD uses 3-letter codes, and numerical
76       codes [5]. The information about old countries [6] and regions [7] also
77       comes from the United Nations.
78
79       In a few cases, there was a conflict between the way how the United
80       Nations spelled a name, and how ISO 3166 spells it. In most cases, is
81       was word order (for instance whether The republic of should preceed the
82       name, or come after the name. A few cases had minor spelling
83       variations. In all such cases, the method in which the UN spelled the
84       name was choosen; ISO 3166 claims to take the names from the UN, so we
85       consider the UN authoritative.
86
87       [1] ISO Maintenance Agency (ISO 3166/MA)
88           http://www.din.de/gremien/nas/nabd/iso3166ma/index.html.
89
90       [2] Country codes,
91           http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1.html, 7
92           September 1999.
93
94       [3] ISO 3166-3, Code for formerly used country names.
95           http://www.din.de/gremien/nas/nabd/iso3166ma/info_pt3.html.
96
97       [4] United Nations, Statistics Division.
98           http://www.un.org/Depts/unsd/statdiv.htm.
99
100       [5] Country or area codes in alphabetical order.
101           http://www.un.org/Depts/unsd/methods/m49alpha.htm, 26 August 1999.
102
103       [6] Codes added or changed.
104           http://www.un.org/Depts/unsd/methods/m49chang.htm, 26 August 1999.
105
106       [7] Geographical regions.
107           http://www.un.org/Depts/unsd/methods/m49regin.htm, 26 August 1999.
108

BUGS

110       Looking up information using country names is far from perfect.  Except
111       for case and the amount of white space, the exact name as it appears on
112       the list has to be given. USA will not return anything, but United
113       States will.
114

DEVELOPMENT

116       The current sources of this module are found on github,
117       <git://github.com/Abigail/geography--countries.git>.
118

AUTHOR

120       Abigail <mailto:geography-countries@abigail.be>.
121
123       Copyright (C) 1999, 2009 by Abigail
124
125       Permission is hereby granted, free of charge, to any person obtaining a
126       copy of this software and associated documentation files (the
127       "Software"), to deal in the Software without restriction, including
128       without limitation the rights to use, copy, modify, merge, publish,
129       distribute, sublicense, and/or sell copies of the Software, and to
130       permit persons to whom the Software is furnished to do so, subject to
131       the following conditions:
132
133       The above copyright notice and this permission notice shall be included
134       in all copies or substantial portions of the Software.
135
136       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
137       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
138       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
139       IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
140       LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
141       FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
142       DEALINGS IN THE SOFTWARE.
143
144
145
146perl v5.32.0                      2020-07-28           Geography::Countries(3)
Impressum