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             => 200,
        subcountries_in_db          => 5297,
        subcountry_cagegories_in_db => 77,
        subcountry_files_downloaded => 249,
        subcountry_info_in_db       => 352,
        }

Called by "report_statistics()".

get_subcountry_count()

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

get_subcountry_category_count()

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

get_subcountry_info_count()

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

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.

read_subcountry_categories_table

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

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

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

read_subcountry_info_table

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

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

This info is a text summary of each country's subcountries, and is taken literally from the 3rd column - 'Subdivisions assigned codes' - of ISO3166-2.

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

report_Australian_statistics

Logs some info for Australia. Does not call "report_statistics()".

report_statistics()

Logs various database statistics at the info level.

Calls "get_statistics()". See that module for what this module reports.

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