logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

WebService::CIA::Source::DBM - An interface to a DBM copy of the CIA World Factbook

Author

       Ian Malpass (ian-cpan@indecorous.com)

Description

       WebService::CIA::Source::DBM is an interface to a pre-compiled DBM copy of the CIA World Factbook.

       The module can also be used to make the DBM file, taking data from 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.

Methods

       Apart from "new", these methods are normally accessed via a WebService::CIA object.

       "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".

       "value($country_code, $field)"
           Retrieve a value from the DBM.

           $country_code    should    be    the     FIPS     10-4     country     code     as     defined     in
           <https://www.cia.gov/library/publications/the-world-factbook/appendix/appendix-d.html>.

           $field  should  be  the  name  of  the  field  whose  value  you  want  to  retrieve,  as  defined in
           <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.)

       "all($country_code)"
           Returns  a  hashref of field-value pairs for $country_code or an empty hashref if $country_code isn't
           in the DBM.

       "set($country_code, $data)"
           Insert or update data in the DBM.

           $country_code should be as described above.

           $data is a hashref of the data to store (as Field => Value).

           "set" overwrites any data already in the DBM under $country_code.

       "dbm()"
           Returns a reference to the DBM file in use.

Name

       WebService::CIA::Source::DBM - An interface to a DBM copy of the CIA World Factbook

See Also

       WebService::CIA, WebService::CIA::Parser, WebService::CIA::Source::Web

perl v5.34.0                                       2022-06-28                  WebService::CIA::Source::DBM(3pm)

Synopsis

         use WebService::CIA::Source::DBM;
         my $source = WebService::CIA::Source::DBM->new({
                                                          DBM  => 'factbook.dbm',
                                                          Mode => 'read'
                                                        });

See Also