Skip Menu |

This queue is for tickets about the Geography-States CPAN distribution.

Report information
The Basics
Id: 30475
Status: new
Priority: 0/
Queue: Geography-States

People
Owner: Nobody in particular
Requestors: andy [...] hexten.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 2.1
Fixed in: (no value)



Subject: Adds support for the UK
This patch adds support for the UK.
Subject: geography-states-andya.patch
diff -uNr Geography-States-2.1.orig/lib/Geography/States.pm Geography-States-2.1/lib/Geography/States.pm --- Geography-States-2.1.orig/lib/Geography/States.pm 2006-10-02 22:35:34.000000000 +0100 +++ Geography-States-2.1/lib/Geography/States.pm 2007-10-08 17:49:04.000000000 +0100 @@ -47,7 +47,7 @@ my (%states); sub _c_length ($) { - lc $_ [0] eq "australia" ? 3 : 2 + $_ [0] =~ /^australia|uk$/i ? 3 : 2 } sub _norm ($$) { @@ -400,4 +400,83 @@ TAS Tasmania VIC Victoria WA Western Australia +# From http://www.uksmg.org/ukcounty.htm +<UK> +ALD Alderney +ATM County Antrim +ARM County Armagh +AVN Avon +BFD Bedfordshire +BRK Berkshire +BDS Borders +BUX Buckinghamshire +CBE Cambridgeshire +CTR Central +CHS Cheshire +CVE Cleveland +CLD Clwyd +CNL Cornwall +CBA Cumbria +DYS Derbyshire +DVN Devon +DOR Dorse +DWN County Down +DGL Dumfries and Galloway +DHM County Durham +DFD Dyfed +ESX Essex +FMH County Fermanagh +FFE Fife +GNM Mid Glamorgan +GNS South Glamorgan +GNW West Glamorgan +GLR Gloucester +GRN Grampian +GUR Guernsey +GWT Gwent +GDD Gwynedd +HPH Hampshire +HWR Hereford and Worcester +HFD Hertfordshire +HLD Highlands +HBS Humberside +IOM Isle of Man +IOW Isle of Wight +JER Jersey +KNT Kent +LNH Lancashire +LEC Leicestershire +LCN Lincolnshire +LDN Greater London +LDR County Londonderry +LTH Lothian +MCH Greater Manchester +MSY Merseyside +NOR Norfolk +NHM Northamptonshire +NLD Northumberland +NOT Nottinghamshire +ORK Orkney +OFE Oxfordshire +PWS Powys +SPE Shropshire +SRK Sark +SLD Shetland +SOM Somerset +SFD Staffordshire +SCD Strathclyde +SFK Suffolk +SRY Surrey +SXE East Sussex +SXW West Sussex +TYS Tayside +TWR Tyne and Wear +TYR County Tyrone +WKS Warwickshire +WIL Western Isles +WMD West Midlands +WLT Wiltshire +YSN North Yorkshire +YSS South Yorkshire +YSW West Yorkshire __END__ diff -uNr Geography-States-2.1.orig/test.pl Geography-States-2.1/test.pl --- Geography-States-2.1.orig/test.pl 2006-10-02 22:32:28.000000000 +0100 +++ Geography-States-2.1/test.pl 2007-10-08 17:50:08.000000000 +0100 @@ -6,7 +6,7 @@ # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) -BEGIN { $| = 1; print "1..21\n"; } +BEGIN { $| = 1; print "1..25\n"; } END {print "not ok 1\n" unless $loaded;} use Geography::States; $loaded = 1; @@ -60,3 +60,8 @@ print $cnd -> state ('NL') eq "Newfoundland and Labrador" ? "ok 22\n" : "not ok 22\n"; + +my $uk = Geography::States -> new ('UK'); +print $uk ? "ok 23\n" : "not ok 23\n"; die unless $uk; +print "Cumbria" eq $uk -> state ('CBA') ? "ok 24\n" : "not ok 24\n"; +print "CBA" eq $uk -> state ('Cumbria') ? "ok 25\n" : "not ok 25\n";