Michael De La Rue > CDB_File-BiIndex-0.030 > CDB_File::BiIndex::Generator

Download:
CDB_File-BiIndex-0.030.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.04   Source  

NAME ^

CDB_File::BiIndex::Generator - build the cdbmake files for a bidirectional index

SYNOPSIS ^

        use CDB_File::BiIndex::Generator;
        $gen = new CDB_File::BiIndex::Generator "test";
        $gen->add_relation("USA", "London");
        $gen->add_relation("Malawi", "Lilongwe");
        $gen->finish();

DESCRIPTION ^

A CDB_File::BiIndex is designed to keep pairs of values and be able to look up bi-directional multivalued relations. This package is designed to generate one of these indexes statically using CDB.

At present this package is a complete hack designed simply to output the two lists in the very specific case which I need.

EXAMPLE ^

Please see the example in the CDB_File::BiIndex documentation. This shows both how to generate and use an index.

METHODS ^

new

        new (CLASS, database_filenamebase)
        new (CLASS, first_database_filename, second_database_filename)

New opens and sets up the databases ready for writing.

$gen->add_relation( first , second ) ^

Adds a key value pair to the database.

$gen->finish() ^

Writes the database so that it is ready for use by CDB_BiIndex.

add_list_first / add_list_second ->(key, list_reference) ^

These functions add an entire set of relations of one string to a list of other strings

add_list_first puts makes the key a key in the first index. add_list_second puts the list in the first index and the key in the second.

syntax highlighting: