.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "WebService::CIA 3pm" .TH WebService::CIA 3pm "2015-06-07" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" WebService::CIA \- Get information from the CIA World Factbook. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use WebService::CIA; \& use WebService::CIA::Source::DBM; \& use WebService::CIA::Source::Web; \& \& # Get data from a pre\-compiled DBM file \& \& my $source = WebService::CIA::Source::DBM\->new({ DBM => "factbook.dbm" }); \& my $cia = WebService::CIA\->new({ Source => $source }); \& $fact = $cia\->get("uk", "Population"); \& print $fact; \& \& # Get data direct from the CIA World Factbook \& \& my $source = WebService::CIA::Source::Web\->new(); \& my $cia = WebService::CIA\->new({ Source => $source }); \& $fact = $cia\->get("uk", "Population"); \& print $fact; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" A module which gets information from the \s-1CIA\s0 World Factbook. .SH "Crypt::SSLeay" .IX Header "Crypt::SSLeay" The most recent version of the \s-1CIA\s0 World Factbook uses \s-1HTTPS\s0 to access its web pages. As such, WebService::CIA requires Crypt::SSLeay which suffers from the usual cryptographic export restriction mumbo jumbo. Sorry about that. .PP Users of ActiveState's ActivePerl should see for instructions on downloading a \s-1PPM\s0 of Crypt::SSLeay. .SH "METHODS" .IX Header "METHODS" .ie n .IP """new(\e%opts)""" 4 .el .IP "\f(CWnew(\e%opts)\fR" 4 .IX Item "new(%opts)" Creates a new WebService::CIA object. Takes a hashref, which must contain a \*(L"Source\*(R" key whose value is a WebService::CIA::Storage object. .ie n .IP """get($country_code, $field)""" 4 .el .IP "\f(CWget($country_code, $field)\fR" 4 .IX Item "get($country_code, $field)" This method retrieves information from the store. .Sp It takes two arguments: a country code (as defined in \s-1FIPS 10\-4\s0 on , e.g. \*(L"uk\*(R", \*(L"us\*(R") and a field name (as defined in , e.g. \*(L"Population\*(R", \*(L"Agriculture \- products\*(R"). (WebService::CIA::Parser also creates four extra fields: \*(L"\s-1URL\*(R", \*(L"URL \-\s0 Print\*(R", \*(L"\s-1URL \-\s0 Flag\*(R", and \*(L"\s-1URL \-\s0 Map\*(R" which are the URLs of the country's Factbook page, the printable version of that page, a \s-1GIF\s0 map of the country, and a \s-1GIF\s0 flag of the country respectively.) .Sp The field name is very case and punctuation sensitive. .Sp It returns the value of the field, or \f(CW\*(C`undef\*(C'\fR if the field or country isn't in the store. .Sp Note that when using WebService::CIA::Store::Web, \f(CW\*(C`get\*(C'\fR will also return \f(CW\*(C`undef\*(C'\fR if there is an error getting the page. .ie n .IP """get_hashref(\e@countries, \e@fields)""" 4 .el .IP "\f(CWget_hashref(\e@countries, \e@fields)\fR" 4 .IX Item "get_hashref(@countries, @fields)" This method takes two arguments: an arrayref of country codes and an arrayref of field names. .Sp It returns a hashref of the form .Sp .Vb 10 \& { \& \*(Aqcountry1\*(Aq => { \& \*(Aqfield1\*(Aq => \*(Aqvalue\*(Aq, \& \*(Aqfield2\*(Aq => \*(Aqvalue\*(Aq \& }, \& \*(Aqcountry2\*(Aq => { \& \*(Aqfield1\*(Aq => \*(Aqvalue\*(Aq, \& \*(Aqfield2\*(Aq => \*(Aqvalue\*(Aq \& } \& } .Ve .ie n .IP """get_all_hashref(\e@countries)""" 4 .el .IP "\f(CWget_all_hashref(\e@countries)\fR" 4 .IX Item "get_all_hashref(@countries)" Get all the fields available for countries. .Sp It takes one argument, an arrayref of country codes. .Sp It returns a hashref similar to the one from \f(CW\*(C`get_hashref\*(C'\fR above, containing all the fields available for each country. .ie n .IP """source()""" 4 .el .IP "\f(CWsource()\fR" 4 .IX Item "source()" Get a reference to the WebService::CIA::Source object in use. .SH "CONFIGURATION VARIABLES" .IX Header "CONFIGURATION VARIABLES" .ie n .IP "$WebService::CIA::base_url" 4 .el .IP "\f(CW$WebService::CIA::base_url\fR" 4 .IX Item "$WebService::CIA::base_url" Sets the base \s-1URL\s0 for the Factbook (currently \&\*(L"https://www.cia.gov/library/publications/the\-world\-factbook/\*(R"). If the Factbook changes location, this can be changed to point to the new location (assuming the relative structure of the Factbook is unchanged). .SH "AUTHOR" .IX Header "AUTHOR" Ian Malpass (ian\-cpan@indecorous.com) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2003\-2007, Ian Malpass .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The \s-1CIA\s0 World Factbook's copyright information page () states: .PP .Vb 2 \& The Factbook is in the public domain. Accordingly, it may be copied \& freely without permission of the Central Intelligence Agency (CIA). .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" WebService::CIA::Parser, WebService::CIA::Source::DBM, WebService::CIA::Source::Web