{"id":22607881,"url":"https://github.com/patch/geo-region-pm6","last_synced_at":"2025-07-27T12:41:41.068Z","repository":{"id":24247081,"uuid":"27640353","full_name":"patch/geo-region-pm6","owner":"patch","description":"Geo::Region (Perl 6): Geographical regions and groupings using UN M.49 + CLDR data","archived":false,"fork":false,"pushed_at":"2018-08-03T22:23:46.000Z","size":94,"stargazers_count":2,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T03:25:38.731Z","etag":null,"topics":["cldr","i18n","perl6","unicode"],"latest_commit_sha":null,"homepage":"","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":null,"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-12-06T16:19:01.000Z","updated_at":"2018-08-03T22:23:47.000Z","dependencies_parsed_at":"2022-08-22T15:20:37.113Z","dependency_job_id":null,"html_url":"https://github.com/patch/geo-region-pm6","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patch%2Fgeo-region-pm6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patch%2Fgeo-region-pm6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patch%2Fgeo-region-pm6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patch%2Fgeo-region-pm6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patch","download_url":"https://codeload.github.com/patch/geo-region-pm6/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248346360,"owners_count":21088445,"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":["cldr","i18n","perl6","unicode"],"created_at":"2024-12-08T14:22:38.807Z","updated_at":"2025-04-11T05:22:20.994Z","avatar_url":"https://github.com/patch.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nGeo::Region - Geographical regions and groupings using UN M.49 and CLDR data\n\n# VERSION\n\nThis document describes Geo::Region for Perl 6, built with Unicode CLDR v26.\n\n# SYNOPSIS\n\n```perl\nuse Geo::Region;\nuse Geo::Region::Enum;\n\n$amer = Geo::Region.new(include =\u003e Region::Americas);\n\n$emea = Geo::Region.new(\n    include =\u003e (Region::Europe, Region::WesternAsia, Region::Africa)\n);\n\n$apac = Geo::Region.new(\n    include =\u003e (Region::Asia, Region::Oceania),\n    exclude =\u003e Region::WesternAsia,\n);\n\nif $amer.contains($country) {\n    # country is in the Americas (US, MX, BR, etc.)\n}\nelsif $emea.contains($country) {\n    # country is in Europe, the Middle East, and Africa (FR, SA, ZW, etc.)\n}\nelsif $apac.contains($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\nv26 Territory\nContainment](http://unicode.org/cldr/charts/26/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 enumerations in [Geo::Region::Enum](lib/Geo/Region/Enum.pm).\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.\n\n    ```perl\n    # countries in the European Union (EU)\n    Geo::Region.new(include =\u003e Region::EuropeanUnion)\n\n    # countries in Asia (142) plus Russia (RU)\n    Geo::Region.new(include =\u003e (Region::Asia, Country::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.new(\n        include =\u003e Region::Europe,\n        exclude =\u003e Region::EuropeanUnion,\n    )\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.contains($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.is-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.countries -\u003e $country {\n    ```\n\n# SEE ALSO\n\n- [Geo::Region::Enum](lib/Geo/Region/Enum.pm) — Enumerations for UN M.49 and CLDR region codes\n- [Unicode CLDR: UN M.49 Territory\nContainment](http://unicode.org/cldr/charts/26/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- [Geo::Region](https://metacpan.org/pod/Geo::Region) for Perl 5\n\n# AUTHOR\n\nNick Patch \u003cpatch@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\n© 2014 Nick Patch\n\nThis library is free software; you can redistribute it and/or modify it under\nthe same terms as Perl 6 itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatch%2Fgeo-region-pm6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatch%2Fgeo-region-pm6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatch%2Fgeo-region-pm6/lists"}