3 %bcond_without tests # do not perform "make test"
5 %include /usr/lib/rpm/macros.perl
8 Summary: Geography::Countries - 2-letter, 3-letter, and numerical codes for countries
9 Summary(pl): Geography::Countries - 2, 3-literowe i numeryczne kody krajów
10 Name: perl-Geography-Countries
14 Group: Development/Languages/Perl
15 Source0: http://www.cpan.org/modules/by-module/%{pdir}/%{pdir}-%{pnam}-%{version}.tar.gz
16 # Source0-md5: 6b4e81ce6aee8c5d9e7e8b74722a5a1d
17 BuildRequires: perl-devel >= 1:5.8.0
18 BuildRequires: rpm-perlprov >= 4.1-13
22 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
25 This module maps country names, and their 2-letter, 3-letter and
26 numerical codes, as defined by the ISO-3166 maintenance agency [1],
27 and defined by the UNSD.
29 =head2 The C<country> subroutine.
31 This subroutine is exported by default. It takes a 2-letter, 3-letter or
32 numerical code, or a country name as argument. In scalar context, it will
33 return the country name, in list context, it will return a list consisting
34 of the 2-letter code, the 3-letter code, the numerical code, the country
35 name, and a flag, which is explained below. Note that not all countries
36 have all 3 codes; if a code is unknown, the undefined value is returned.
38 There are 3 categories of countries. The largest category are the
39 current countries. Then there is a small set of countries that no
40 longer exist. The final set consists of areas consisting of multiple
41 countries, like I<Africa>. No 2-letter or 3-letter codes are available
42 for the second two sets. (ISO 3166-3 [3] defines 4 letter codes for the
43 set of countries that no longer exist, but the author of this module
44 was unable to get her hands on that standard.) By default, C<country>
45 only returns countries from the first set, but this can be changed
46 by giving C<country> an optional second argument.
48 The module optionally exports the constants C<CNT_F_REGULAR>,
49 C<CNT_F_OLD>, C<CNT_F_REGION> and C<CNT_F_ANY>. These constants can also
50 be important all at once by using the tag C<:FLAGS>. C<CNT_F_ANY> is just
51 the binary or of the three other flags. The second argument of C<country>
52 should be the binary or of a subset of the flags C<CNT_F_REGULAR>,
53 C<CNT_F_OLD>, and C<CNT_F_REGION> - if no, or a false, second argument is
54 given, C<CNT_F_REGULAR> is assumed. If C<CNT_F_REGULAR> is set, regular
55 (current) countries will be returned; if C<CNT_F_OLD> is set, old,
56 no longer existing, countries will be returned, while C<CNT_F_REGION>
57 is used in case a region (not necessarely) a country might be returned.
58 If C<country> is used in list context, the fifth returned element is
59 one of C<CNT_F_REGULAR>, C<CNT_F_OLD> and C<CNT_F_REGION>, indicating
60 whether the result is a regular country, an old country, or a region.
62 In list context, C<country> returns a 5 element list. To avoid having
63 to remember which element is in which index, the constants C<CNT_I_CODE2>,
64 C<CNT_I_CODE3>, C<CNT_I_NUMCODE>, C<CNT_I_COUNTRY> and C<CNT_I_FLAG>
65 can be imported. Those constants contain the indices of the 2-letter code,
66 the 3-letter code, the numerical code, the country, and the flag explained
67 above, respectively. All index constants can be imported by using the
70 =head2 The C<code2>, C<code3>, C<numcode> and C<countries> routines.
72 All known 2-letter codes, 3-letter codes, numerical codes and country
73 names can be returned by the routines C<code2>, C<code3>, C<numcode> and
74 C<countries>. None of these methods is exported by default; all need to
75 be imported if one wants to use them. The tag C<:LISTS> imports them
76 all. In scalar context, the number of known codes or countries is returned.
82 %setup -q -n %{pdir}-%{pnam}-%{version}
85 %{__perl} Makefile.PL \
89 %{?with_tests:%{__make} test}
92 rm -rf $RPM_BUILD_ROOT
95 DESTDIR=$RPM_BUILD_ROOT
98 rm -rf $RPM_BUILD_ROOT
101 %defattr(644,root,root,755)
102 %{perl_vendorlib}/Geography/*.pm