10 Sep 2014 22:57:11 UTC
- Distribution: Global-Rainbow-Map
- Module version: 0.002
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Testers (324 / 0 / 13)
- KwaliteeBus factor: 1
- 94.29% Coverage
- License: unrestricted
- Activity24 month
- Download (617.02KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userTOBYINK Toby Inkster
- SEE ALSO
- COPYRIGHT AND LICENCE
- DISCLAIMER OF WARRANTIES
Global::Rainbow::Map - make the world look like a rainbow, but usefully
my $map = Global::Rainbow::Map->new( gb => 'red', ca => 'orange', in => 'yellow', nz => 'green', au => 'blue', lk => 'purple', ); print $map->svg;
Global::Rainbow::Map generates a map of the world (Robinson projection) with each country shaded whatever colour you like. In fact, you can even choose colours that don't appear in the rainbow... like magenta!
The possibilities for such a module are clearly endless. If you had a table listing per-capita alcohol consumption, you could create a map of the world in different colours to illustrate per-capita alcohol consumption. Or if you had a table of which countries had won the most Olympic medals for swimming, then you could create a map of the world in different colours to illustrate which countries had won the most Olympic medals for swimming.
The template map used is Wikipedia's public domain blank world map http://en.wikipedia.org/wiki/File:BlankMap-World6.svg, the 14 Feb 2012 revision.
Creates a new map. The hash is a list of country code to colour pairings.
Country codes are typically ISO 3166-1 two letter codes. If you don't know the code for a particular country, Locale::Country can help you out. There are a number of additional codes like "eu" (the whole European Union) and "aq" (Antarctica). These codes are all lower case.
Colours can be hexadecimal codes like '#ff0000' or named colours from the SVG or X11 palettes. Countries not coloured will remain a pale grey.
Hash keys which do not match the regular expression
/^[a-z][a-z0-9-]*[a-z0-9]$/, in particular hash keys starting with a hyphen are reserved for future use.
The useful ones:
Returns the coloured SVG map as a string.
Returns the same coloured SVG map, but as an XML::LibXML::Document.
Somewhat less useful for everyday use, but may be useful for people subclassing this module...
Returns the list of country codes which have been explicitly assigned a colour (i.e. the keys to the hash given in the constructor).
Returns the colour for a country, as a blessed Color::Library::Color object.
Will return undef if the country has not been explicitly assigned a colour.
Generates the CSS that would be inserted into the SVG output.
Again, these are mostly useful for people subclassing the module.
Returns the template used for maps as an XML::LibXML::Document.
Fetching the template and modifying it using DOM methods will affect all maps subsequently generated for the lifetime of the process. So beware.
get_template, but returns a clone of the template.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Global-Rainbow-Map.
Toby Inkster <firstname.lastname@example.org>.
Toby Inkster, 2012. No rights reserved.
To the extent possible under law, Toby Inkster has waived all copyright and related or neighboring rights to Global::Rainbow::Map. This work is published from: United Kingdom.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Module Install Instructions
To install Global::Rainbow::Map, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Global::Rainbow::Map
For more information on module installation, please visit the detailed CPAN module installation guide.