WebService-CIA
view release on metacpan or search on metacpan
lib/WebService/CIA/Source/DBM.pm view on Meta::CPAN
WebService::CIA::Parser (or WebService::CIA::Source::Web) and inserting it into a DBM.
A script to do this - webservice-cia-makedbm.pl - should be included in this
module's distribution.
=head1 METHODS
Apart from C<new>, these methods are normally accessed via a WebService::CIA object.
=over 4
=item C<new(\%opts)>
This method creates a new WebService::CIA::Source::DBM object. It takes a hashref of
options. Valid keys are "DBM" and "Mode".
DBM is mandatory and should be the location of the DBM file to be used.
Mode is optional and can be either "read" or "readwrite". It defaults to
"read".
=item C<value($country_code, $field)>
Retrieve a value from the DBM.
C<$country_code> should be the FIPS 10-4 country code as defined in
L<https://www.cia.gov/library/publications/the-world-factbook/appendix/appendix-d.html>.
C<$field> should be the name of the field whose value you want to
retrieve, as defined in
L<https://www.cia.gov/library/publications/the-world-factbook/docs/notesanddefs.html>.
(WebService::CIA::Parser also creates four extra fields: "URL", "URL - Print",
"URL - Flag", and "URL - Map" which are the URLs of the country's Factbook
page, the printable version of that page, a GIF map of the country, and a
GIF flag of the country respectively.)
=item C<all($country_code)>
Returns a hashref of field-value pairs for C<$country_code> or an empty
hashref if C<$country_code> isn't in the DBM.
=item C<set($country_code, $data)>
Insert or update data in the DBM.
C<$country_code> should be as described above.
C<$data> is a hashref of the data to store (as Field =E<gt> Value).
C<set> B<overwrites> any data already in the DBM under C<$country_code>.
=item C<dbm()>
Returns a reference to the DBM file in use.
=back
=head1 AUTHOR
Ian Malpass (ian-cpan@indecorous.com)
=head1 COPYRIGHT
Copyright 2003-2007, Ian Malpass
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
The CIA World Factbook's copyright information page
(L<https://www.cia.gov/library/publications/the-world-factbook/docs/contributor_copyright.html>)
states:
The Factbook is in the public domain. Accordingly, it may be copied
freely without permission of the Central Intelligence Agency (CIA).
=head1 SEE ALSO
WebService::CIA, WebService::CIA::Parser, WebService::CIA::Source::Web
=cut
( run in 0.778 second using v1.01-cache-2.11-cpan-39bf76dae61 )