⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 locale::country.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "Locale::Country 3".TH Locale::Country 3 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"Locale::Country \- ISO codes for country identification (ISO 3166).SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 1\&    use Locale::Country;\&    \&    $country = code2country(\*(Aqjp\*(Aq);        # $country gets \*(AqJapan\*(Aq\&    $code    = country2code(\*(AqNorway\*(Aq);    # $code gets \*(Aqno\*(Aq\&    \&    @codes   = all_country_codes();\&    @names   = all_country_names();\&    \&    # semi\-private routines\&    Locale::Country::alias_code(\*(Aquk\*(Aq => \*(Aqgb\*(Aq);\&    Locale::Country::rename_country(\*(Aqgb\*(Aq => \*(AqGreat Britain\*(Aq);.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"The \f(CW\*(C`Locale::Country\*(C'\fR module provides access to the \s-1ISO\s0codes for identifying countries, as defined in \s-1ISO\s0 3166\-1.You can either access the codes via the \*(L"conversion routines\*(R"(described below), or with the two functions which return listsof all country codes or all country names..PPThere are three different code sets you can use for identifyingcountries:.IP "\fBalpha\-2\fR" 4.IX Item "alpha-2"Two letter codes, such as 'tv' for Tuvalu.This code set is identified with the symbol \f(CW\*(C`LOCALE_CODE_ALPHA_2\*(C'\fR..IP "\fBalpha\-3\fR" 4.IX Item "alpha-3"Three letter codes, such as 'brb' for Barbados.This code set is identified with the symbol \f(CW\*(C`LOCALE_CODE_ALPHA_3\*(C'\fR..IP "\fBnumeric\fR" 4.IX Item "numeric"Numeric codes, such as 064 for Bhutan.This code set is identified with the symbol \f(CW\*(C`LOCALE_CODE_NUMERIC\*(C'\fR..PPAll of the routines take an optional additional argumentwhich specifies the code set to use.If not specified, it defaults to the two-letter codes.This is partly for backwards compatibility (previous versionsof this module only supported the alpha\-2 codes), andpartly because they are the most widely used codes..PPThe alpha\-2 and alpha\-3 codes are not case-dependent,so you can use '\s-1BO\s0', 'Bo', 'bO' or 'bo' for Bolivia.When a code is returned by one of the functions inthis module, it will always be lower-case..PPAs of version 2.00, Locale::Country supports variantnames for countries. So, for example, the country code for \*(L"United States\*(R"is \*(L"us\*(R", so country2code('United States') returns 'us'.Now the following will also return 'us':.PP.Vb 2\&    country2code(\*(AqUnited States of America\*(Aq) \&    country2code(\*(AqUSA\*(Aq).Ve.SH "CONVERSION ROUTINES".IX Header "CONVERSION ROUTINES"There are three conversion routines: \f(CW\*(C`code2country()\*(C'\fR, \f(CW\*(C`country2code()\*(C'\fR,and \f(CW\*(C`country_code2code()\*(C'\fR..IP "code2country( \s-1CODE\s0, [ \s-1CODESET\s0 ] )" 4.IX Item "code2country( CODE, [ CODESET ] )"This function takes a country code and returns a stringwhich contains the name of the country identified.If the code is not a valid country code, as defined by \s-1ISO\s0 3166,then \f(CW\*(C`undef\*(C'\fR will be returned:.Sp.Vb 1\&    $country = code2country(\*(Aqfi\*(Aq);.Ve.IP "country2code( \s-1STRING\s0, [ \s-1CODESET\s0 ] )" 4.IX Item "country2code( STRING, [ CODESET ] )"This function takes a country name and returns the correspondingcountry code, if such exists.If the argument could not be identified as a country name,then \f(CW\*(C`undef\*(C'\fR will be returned:.Sp.Vb 2\&    $code = country2code(\*(AqNorway\*(Aq, LOCALE_CODE_ALPHA_3);\&    # $code will now be \*(Aqnor\*(Aq.Ve.SpThe case of the country name is not important.See the section \*(L"\s-1KNOWN\s0 \s-1BUGS\s0 \s-1AND\s0 \s-1LIMITATIONS\s0\*(R" below..IP "country_code2code( \s-1CODE\s0, \s-1CODESET\s0, \s-1CODESET\s0 )" 4.IX Item "country_code2code( CODE, CODESET, CODESET )"This function takes a country code from one code set,and returns the corresponding code from another code set..Sp.Vb 3\&    $alpha2 = country_code2code(\*(Aqfin\*(Aq,\&                 LOCALE_CODE_ALPHA_3, LOCALE_CODE_ALPHA_2);\&    # $alpha2 will now be \*(Aqfi\*(Aq.Ve.SpIf the code passed is not a valid country code inthe first code set, or if there isn't a code for thecorresponding country in the second code set,then \f(CW\*(C`undef\*(C'\fR will be returned..SH "QUERY ROUTINES".IX Header "QUERY ROUTINES"There are two function which can be used to obtain a list of all codes,or all country names:.ie n .IP """all_country_codes( [ CODESET ] )""" 4.el .IP "\f(CWall_country_codes( [ CODESET ] )\fR" 4.IX Item "all_country_codes( [ CODESET ] )"Returns a list of all two-letter country codes.The codes are guaranteed to be all lower-case,and not in any particular order..ie n .IP """all_country_names( [ CODESET ] )""" 4.el .IP "\f(CWall_country_names( [ CODESET ] )\fR" 4.IX Item "all_country_names( [ CODESET ] )"Returns a list of all country names for which there is a correspondingcountry code in the specified code set.The names are capitalised, and not returned in any particular order..SpNot all countries have alpha\-3 and numeric codes \-some just have an alpha\-2 code,so you'll get a different number of countriesdepending on which code set you specify..SH "SEMI-PRIVATE ROUTINES".IX Header "SEMI-PRIVATE ROUTINES"Locale::Country provides two semi-private routines for modifyingthe internal data.Given their status, they aren't exported by default,and so need to be called by prefixing the function name with thepackage name..Sh "alias_code".IX Subsection "alias_code"Define a new code as an alias for an existing code:.PP.Vb 1\&    Locale::Country::alias_code( ALIAS => CODE [, CODESET ] ).Ve.PPThis feature was added as a mechanism for handlinga \*(L"uk\*(R" code. The \s-1ISO\s0 standard says that the two-letter code for\&\*(L"United Kingdom\*(R" is \*(L"gb\*(R", whereas domain names are all .uk..PPBy default the module does not understand \*(L"uk\*(R", since it is implementingan \s-1ISO\s0 standard. If you would like 'uk' to work as the two-lettercode for United Kingdom, use the following:.PP.Vb 1\&    Locale::Country::alias_code(\*(Aquk\*(Aq => \*(Aqgb\*(Aq);.Ve.PPWith this code, both \*(L"uk\*(R" and \*(L"gb\*(R" are valid codes for United Kingdom,with the reverse lookup returning \*(L"uk\*(R" rather than the usual \*(L"gb\*(R"..PP\&\fBNote:\fR this function was previously called _alias_code,but the leading underscore has been dropped.The old name will be supported for all 2.X releases forbackwards compatibility..Sh "rename_country".IX Subsection "rename_country"If the official country name just isn't good enough for you,you can rename a country. For example, the official countryname for code 'gb' is 'United Kingdom'.If you want to change that, you might call:.PP.Vb 1\&    Locale::Country::rename_country(\*(Aqgb\*(Aq => \*(AqGreat Britain\*(Aq);.Ve.PPThis means that calling code2country('gb') will now return\&'Great Britain' instead of 'United Kingdom'.The original country name is retained as an alias,so for the above example, country2code('United Kingdom')will still return 'gb'..SH "EXAMPLES".IX Header "EXAMPLES"The following example illustrates use of the \f(CW\*(C`code2country()\*(C'\fR function.The user is prompted for a country code, and then told the correspondingcountry name:.PP.Vb 1\&    $| = 1;   # turn off buffering\&    \&    print "Enter country code: ";\&    chop($code = <STDIN>);\&    $country = code2country($code, LOCALE_CODE_ALPHA_2);\&    if (defined $country)\&    {\&        print "$code = $country\en";\&    }\&    else\&    {\&        print "\*(Aq$code\*(Aq is not a valid country code!\en";\&    }.Ve.SH "DOMAIN NAMES".IX Header "DOMAIN NAMES"Most top-level domain names are based on these codes,but there are certain codes which aren't.If you are using this module to identify country from hostname,your best bet is to preprocess the country code..PPFor example, \fBedu\fR, \fBcom\fR, \fBgov\fR and friends would map to \fBus\fR;\&\fBuk\fR would map to \fBgb\fR. Any others?.SH "KNOWN BUGS AND LIMITATIONS".IX Header "KNOWN BUGS AND LIMITATIONS".IP "\(bu" 4When using \f(CW\*(C`country2code()\*(C'\fR, the country name must currently appearexactly as it does in the source of the module. The module now supportsa small number of variants..SpPossible extensions to this are: an interface for getting at thelist of variant names, and regular expression matches..IP "\(bu" 4In the current implementation, all data is read in when themodule is loaded, and then held in memory.A lazy implementation would be more memory friendly..IP "\(bu" 4Support for country names in different languages..SH "SEE ALSO".IX Header "SEE ALSO".IP "Locale::Language" 4.IX Item "Locale::Language"\&\s-1ISO\s0 two letter codes for identification of language (\s-1ISO\s0 639)..IP "Locale::Script" 4.IX Item "Locale::Script"\&\s-1ISO\s0 codes for identification of scripts (\s-1ISO\s0 15924)..IP "Locale::Currency" 4.IX Item "Locale::Currency"\&\s-1ISO\s0 three letter codes for identification of currenciesand funds (\s-1ISO\s0 4217)..IP "Locale::SubCountry" 4.IX Item "Locale::SubCountry"\&\s-1ISO\s0 codes for country sub-divisions (states, counties, provinces, etc),as defined in \s-1ISO\s0 3166\-2.This module is not part of the Locale-Codes distribution,but is available from \s-1CPAN\s0 in CPAN/modules/by\-module/Locale/.IP "\s-1ISO\s0 3166\-1" 4.IX Item "ISO 3166-1"The \s-1ISO\s0 standard which defines these codes..IP "http://www.iso.org/iso/en/prods\-services/iso3166ma/index.html" 4.IX Item "http://www.iso.org/iso/en/prods-services/iso3166ma/index.html"Official home page for the \s-1ISO\s0 3166 maintenance agency..IP "http://www.egt.ie/standards/iso3166/iso3166\-1\-en.html" 4.IX Item "http://www.egt.ie/standards/iso3166/iso3166-1-en.html"Another useful, but not official, home page..IP "http://www.cia.gov/cia/publications/factbook/docs/app\-d\-1.html" 4.IX Item "http://www.cia.gov/cia/publications/factbook/docs/app-d-1.html"An appendix in the \s-1CIA\s0 world fact book which lists country codesas defined by \s-1ISO\s0 3166, \s-1FIPS\s0 10\-4, and internet domain names..SH "AUTHOR".IX Header "AUTHOR"Neil Bowers <neil@bowers.com>.SH "COPYRIGHT".IX Header "COPYRIGHT"Copyright (C) 2002\-2004, Neil Bowers..PPCopyright (c) 1997\-2001 Canon Research Centre Europe (\s-1CRE\s0)..PPThis module is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -