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

NAME

Locale::Object::DB - do database lookups for Locale::Object modules

VERSION

0.1

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

Because the database file isn't a Perl file, Module::Build won't copy it into the blib directory at the ./Build test stage, and To get around this, Locale::Object::DB installs the database into the same directory as itself, and makes a symlink to the database in /tmp (unless one exists already) which the

AUTHOR

Earle Martin <EMARTIN@cpan.org>

http://purl.oclc.org/net/earlemartin/

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.