The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::Scraper::Wikipedia::ISO3166::Database - The interface to www.scraper.wikipedia.iso3166.sqlite

Synopsis

See "Synopsis" in WWW::Scraper::Wikipedia::ISO3166 for a long synopsis.

Description

Documents the methods end-users need to access the SQLite database, www.scraper.wikipedia.iso3166.sqlite, which ships with this distro.

See "Description" in WWW::Scraper::Wikipedia::ISO3166 for a long description.

See scripts/export.as.csv.pl, scripts/export.as.html.pl and scripts/report.statistics.pl.

Distributions

This module is available as a Unix-style distro (*.tgz).

See http://savage.net.au/Perl-modules.html for details.

See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing.

Constructor and initialization

new(...) returns an object of type WWW::Scraper::Wikipedia::ISO3166::Database.

This is the class's contructor.

Usage: WWW::Scraper::Wikipedia::ISO3166::Database -> new().

This method takes a hash of options.

Call new() as new(option_1 => value_1, option_2 => value_2, ...).

Available options:

o attributes => $hash_ref

This is the hashref of attributes passed to DBI's connect() method.

Default: {AutoCommit => 1, RaiseError => 1, sqlite_unicode => 1}

Methods

This module is a sub-class of WWW::Scraper::Wikipedia::ISO3166 and consequently inherits its methods.

attributes($hashref)

Get or set the hashref of attributes passes to DBI's connect() method.

Also, attributes is an option to "new()".

find_subcountry_downloads()

Returns an arrayref of 2-letter codes of countries whose subcountry page has been downloaded to data/*$code2.html.

get_country_count()

Returns the result of: 'select count(*) from countries'.

get_statistics()

Returns a hashref of database statistics:

        {
        countries_in_db             => 249,
        has_subcounties             => 199,
        subcountries_in_db          => 4593,
        subcountry_files_downloaded => 249,
        }

Called by "report_statistics()".

get_subcountry_count()

Returns the result of: 'select count(*) from subcountries'.

new()

See "Constructor and initialization".

read_countries_table()

Returns a hashref of hashrefs for this SQL: 'select * from countries'.

The key of the hashref is the primary key (integer) of the countries table.

This is discussed further in "Methods which return hashrefs" in WWW::Scraper::Wikipedia::ISO3166.

read_subcountries_table()

Returns a hashref of hashrefs for this SQL: 'select * from subcountries'.

The key of the hashref is the primary key (integer) of the subcountries table.

This is discussed further in "Methods which return hashrefs" in WWW::Scraper::Wikipedia::ISO3166.

report_statistics()

Logs various database statistics at the info level.

Calls "get_statistics()".

This is the output from scripts/report.statistics.pl -v 1:

        info: countries_in_db => 249.
        info: has_subcounties => 199.
        info: subcountries_in_db => 4593.
        info: subcountry_files_downloaded => 249.

verbose($integer)

Get or set the verbosity level.

Also, verbose is an option to "new()".

who_has_subcountries()

Returns an arrayref of primary keys (integers) in the countries table, of those countries who have subcountry entries in the subcountries table.

FAQ

For the database schema, etc, see "FAQ" in WWW::Scraper::Wikipedia::ISO3166.

References

See "References" in WWW::Scraper::Wikipedia::ISO3166.

Support

Email the author, or log a bug on RT:

https://rt.cpan.org/Public/Dist/Display.html?Name=WWW::Scraper::Wikipedia::ISO3166.

Author

WWW::Scraper::Wikipedia::ISO3166 was written by Ron Savage <ron@savage.net.au> in 2012.

Home page: http://savage.net.au/index.html.

Copyright

Australian copyright (c) 2012 Ron Savage.

        All Programs of mine are 'OSI Certified Open Source Software';
        you can redistribute them and/or modify them under the terms of
        The Artistic License, a copy of which is available at:
        http://www.opensource.org/licenses/index.html