meetn2veg has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Not CGI related but possibly a tricky one...

Replies are listed 'Best First'.
(jeffa) Re: Not CGI related but possibly a tricky one...
by jeffa (Bishop) on Oct 13, 2002 at 17:29 UTC
    CPAN yields a Net::Country module, but you don't want this ... use Abigail-II's much more useful Geography::Countries, as merlyn prescribes:
    use strict; use Geography::Countries qw(country code2); use CGI qw(popup_menu); my %labels; $labels{$_} = country($_) for code2(); print popup_menu( -name => 'countries', -values => [sort keys %labels], -labels => \%labels, );
    BUU's suggestion is practicle, but there is the ever so slight risk that the list you are copying from is wrong.

    I recommend running this script on the command line and redirecting the output to a file, instead of using it as a CGI script (unless you have some caching mechanism employed ;)).

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
•Re: Not CGI related but possibly a tricky one...
by merlyn (Sage) on Oct 13, 2002 at 17:11 UTC
Re: Not CGI related but possibly a tricky one...
by shotgunefx (Parson) on Oct 14, 2002 at 08:02 UTC
    You could use the now standard (as of 5.8) module Locale::Country. You may also find this node useful.

    -Lee

    "To be civilized is to deny one's nature."
Re: Not CGI related but possibly a tricky one...
by BUU (Prior) on Oct 13, 2002 at 16:48 UTC
    Copy one from some other site?