Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Geography::States 2009040901

    Download button

    No screenshots available
    Downloads: 290  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Abigail | More programs
    Perl Artistic License / FREE
    February 15th, 2007, 03:05 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Geography::States description

    A Perl module with map states and provinces to their codes, and vice versa.

    Geography::States is a Perl module with map states and provinces to their codes, and vice versa.

    SYNOPSIS

    use Geography::States;

    my $obj = Geography::States -> new (COUNTRY [, STRICT]);

    EXAMPLES

    my $canada = Geography::States -> new ('Canada');

    my $name = $canada -> state ('NF'); # Newfoundland.
    my $code = $canada -> state ('Ontario'); # ON.
    my ($code, $name) = $canada -> state ('BC'); # BC, British Columbia.
    my @all_states = $canada -> state; # List code/name pairs.


    This module lets you map states and provinces to their codes, and codes to names of provinces and states.

    The Geography::States - new ()> call takes 1 or 2 arguments. The first, required, argument is the country we are interested in. Current supported countries are USA, Brazil, Canada, The Netherlands, and Australia. If a second non-false argument is given, we use strict mode. In non-strict mode, we will map territories and alternative codes as well, while we do not do that in strict mode. For example, if the country is USA, in non-strict mode, we will map GU to Guam, while in strict mode, neither GU and Guam will be found.

    The state() method

    All queries are done by calling the state method in the object. This method takes an optional argument. If an argument is given, then in scalar context, it will return the name of the state if a code of a state is given, and the code of a state, if the argument of the method is a name of a state. In list context, both the code and the state will be returned.

    If no argument is given, then the state method in list context will return a list of all code/name pairs for that country. In scalar context, it will return the number of code/name pairs. Each code/name pair is a 2 element anonymous array.

    Arguments can be given in a case insensitive way; if a name consists of multiple parts, the number of spaces does not matter, as long as there is some whitespace. (That is "NewYork" is wrong, but "new YORK" is fine.)


    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    states maps | provinces maps | Perl module | Geography | map | states

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM