NAME
Locale::Object::DB - do database lookups for Locale::Object modules
VERSION
0.11
DESCRIPTION
This module provides common functionality for the Locale::Object modules by doing lookups in the database that comes with them (which uses DBD::SQLite).
SYNOPSIS
use Locale::Object::DB;
my $db = Locale::Object::DB->new();
my $table = 'country';
my $what = 'name';
my $value = 'Afghanistan';
my @results = $db->lookup($table, $what, $value);
my %countries;
$table = 'continent';
my $result_column = 'country_code';
foreach my $result ( $db->lookup_all(
table => $table,
result_column => $result_column,
search_column => $what,
value => $value) ) {
# fill up %countries with countries in the same continent as $value
$countries{$result} = 1;
}
METHODS
lookup()
$db->lookup($table, $what, $value);
lookup
will return an array of results from a query of the database for a row matching the table name, column name and cell value that you specify. If no match was found, a message saying so will be returned. Any NULL values in matching rows will be returned in the results as UNDEF.
lookup_all()
$db->lookup_all( table => $table, result_column => $result_column,
search_column => $search_column, value => $value );
lookup_all
will return an array of results for a query of the database for cells in $result_column in $table that are in a row that has $value in $search_column.
For information on what db tables are available and where the data came from, see Locale::Object::DB::Schemata.
NOTES
The database file itself is named locale.db
and must reside in the same directory as this module. If it's not present, the module will croak with a fatal error.
AUTHOR
Earle Martin <EMARTIN@cpan.org>
CREDITS
See the credits for Locale::Object.
LEGAL
Copyright 2003 Fotango Ltd. All rights reserved. http://opensource.fotango.com/
This module is released under the same license as Perl itself, and is provided on an "as is" basis. The author and Fotango Ltd make no warranties of any kind, either expressed or implied, as to the accuracy and/or utility of any results obtained from its use. However, if you do find something wrong with the results, please let the author know. Thanks.