{"id":22607861,"url":"https://github.com/patch/geo-region-pm5","last_synced_at":"2025-03-28T22:19:56.254Z","repository":{"id":21425975,"uuid":"24744102","full_name":"patch/geo-region-pm5","owner":"patch","description":"Geo::Region (Perl 5): Geographical regions and groupings using UN M.49 + CLDR data","archived":false,"fork":false,"pushed_at":"2015-03-23T22:59:21.000Z","size":476,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-03T08:48:04.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Geo::Region","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patch.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-03T02:14:28.000Z","updated_at":"2015-03-23T22:43:40.000Z","dependencies_parsed_at":"2022-07-21T08:18:05.048Z","dependency_job_id":null,"html_url":"https://github.com/patch/geo-region-pm5","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patch%2Fgeo-region-pm5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patch%2Fgeo-region-pm5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patch%2Fgeo-region-pm5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patch%2Fgeo-region-pm5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patch","download_url":"https://codeload.github.com/patch/geo-region-pm5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246106697,"owners_count":20724401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-08T14:22:35.328Z","updated_at":"2025-03-28T22:19:56.228Z","avatar_url":"https://github.com/patch.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build status](https://travis-ci.org/patch/geo-region-pm5.png)](https://travis-ci.org/patch/geo-region-pm5)\n[![Coverage status](https://coveralls.io/repos/patch/geo-region-pm5/badge.png)](https://coveralls.io/r/patch/geo-region-pm5)\n[![CPAN version](https://badge.fury.io/pl/Geo-Region.png)](http://badge.fury.io/pl/Geo-Region)\n\n# NAME\n\nGeo::Region - Geographical regions and groupings using UN M.49 and CLDR data\n\n# VERSION\n\nThis document describes Geo::Region v0.07, built with Unicode CLDR v27.\n\n# SYNOPSIS\n\n```perl\nuse Geo::Region;\nuse Geo::Region::Constant qw( :all );\n\n$amer = Geo::Region-\u003enew( AMERICAS );\n$emea = Geo::Region-\u003enew([ EUROPE, WESTERN_ASIA, AFRICA ]);\n$apac = Geo::Region-\u003enew([ ASIA, OCEANIA ], exclude =\u003e WESTERN_ASIA );\n\nif ( $amer-\u003econtains($country) ) {\n    # country is in the Americas (US, MX, BR, etc.)\n}\nelsif ( $emea-\u003econtains($country) ) {\n    # country is in Europe, the Middle East, and Africa (FR, SA, ZW, etc.)\n}\nelsif ( $apac-\u003econtains($country) ) {\n    # country is in Asia-Pacific (JP, TH, AU, etc.)\n}\n```\n\n# DESCRIPTION\n\nThis class is used to create geographical regions and groupings of subregions\nand countries. Default regional groupings are provided using the [Unicode CLDR\nv27 Territory\nContainment](http://unicode.org/cldr/charts/27/supplemental/territory_containment_un_m_49.html)\ndata, which is an extension of the United Nations [UN\nM.49 (Rev.3)](http://unstats.un.org/unsd/methods/m49/m49regin.htm) standard.\n\n## Regions\n\nRegions and subregions are represented with UN M.49 region codes, such as **419**\nfor Latin America and **035** for Southeast Asia. Either the official format\nusing a three-digit `0`-padded string like `'035'` or an integer like `35`\nmay be used with this class. Note when using the `0`-padded format that it must\nbe quoted as a string so as not to be treated as on octal literal. The CLDR also\nadds two additional two-letter region codes which are supported: **EU** for the\nEuropean Union and **QO** for Outlying Oceania. These region codes are all\navailable as constants in [Geo::Region::Constant](https://metacpan.org/pod/Geo::Region::Constant).\n\n## Countries\n\nCountries and territories are represented with ISO 3166-1 alpha-2 country codes,\nsuch as **JP** for Japan and **AQ** for Antarctica, and are case insensitive.\nUnlike with region codes, the three-digit forms of country codes are not\ncurrently supported, nor are three-letter codes. The deprecated code **UK** for\nthe United Kingdom is supported as an alias of the official code **GB**.\n\n## Constructor\n\nThe `new` class method is used to construct a Geo::Region object along with the\n`include` argument and optional `exclude` argument.\n\n- `include`\n\n    Accepts either a single region code or an array reference of region or country\n    codes to be included in the resulting custom region. When passed to the `new`\n    constructor as the first or only argument, the value may be given without the\n    `include` key.\n\n    ```perl\n    # countries in the European Union (EU)\n    Geo::Region-\u003enew( include =\u003e EUROPEAN_UNION )\n    Geo::Region-\u003enew( EUROPEAN_UNION )\n\n    # countries in Asia (142) plus Russia (RU)\n    Geo::Region-\u003enew( include =\u003e [ ASIA, RUSSIA ])\n    Geo::Region-\u003enew([ ASIA, RUSSIA ])\n    ```\n\n- `exclude`\n\n    Accepts values in the same format as `include`. This can be used to exclude\n    countries or subregions from a region.\n\n    ```perl\n    # countries in Europe (150) which are not in the European Union (EU)\n    Geo::Region-\u003enew( include =\u003e EUROPE, exclude =\u003e EUROPEAN_UNION )\n    Geo::Region-\u003enew( EUROPE, exclude =\u003e EUROPEAN_UNION )\n    ```\n\n## Methods\n\n- `contains`\n\n    Given a country or region code, determines if the region represented by the\n    Geo::Region instance contains it.\n\n    ```perl\n    if ( $region-\u003econtains($country) ) {\n    ```\n\n- `is_within`\n\n    Given a region code, determines if all the countries and regions represented by\n    the Geo::Region instance are within it.\n\n    ```perl\n    if ( $subregion-\u003eis_within($region) ) {\n    ```\n\n- `countries`\n\n    Returns a list of country codes of the countries within the region represented\n    by the Geo::Region instance.\n\n    ```perl\n    for ( $region-\u003ecountries ) {\n    ```\n\n# SEE ALSO\n\n- [Geo::Region::Constant](https://metacpan.org/pod/Geo::Region::Constant) — Constants for UN M.49 and CLDR region codes\n- [Unicode CLDR: UN M.49 Territory\nContainment](http://unicode.org/cldr/charts/27/supplemental/territory_containment_un_m_49.html)\n- [United Nations: UN M.49 Standard Country, Area, \u0026 Region\nCodes](http://unstats.un.org/unsd/methods/m49/m49regin.htm)\n- [Locale::CLDR: Territory Containment](https://metacpan.org/pod/Locale::CLDR#Territory-Containment)\n- [Geo::Region](https://github.com/patch/geo-region-pm6) for Perl 6\n\n# AUTHOR\n\nNick Patch \u003cpatch@cpan.org\u003e\n\nThis project is brought to you by [Perl CLDR](http://perl-cldr.github.io/) and\n[Shutterstock](http://www.shutterstock.com/). Additional open source projects\nfrom Shutterstock can be found at\n[code.shutterstock.com](http://code.shutterstock.com/).\n\n# COPYRIGHT AND LICENSE\n\n© 2014–2015 Shutterstock, Inc.\n\nThis library is free software; you can redistribute it and/or modify it under\nthe same terms as Perl itself.\n\nUnicode is a registered trademark of Unicode, Inc., in the United States and\nother countries.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatch%2Fgeo-region-pm5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatch%2Fgeo-region-pm5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatch%2Fgeo-region-pm5/lists"}