Data::LetterTree - Native letter tree Perl binding


Data-LetterTree documentation  | view source Contained in the Data-LetterTree distribution.

Index


SYNOPSIS

Top

    use Data::LetterTree;

    my $tree = Data::LetterTree->new();

    $tree->add_data('foo', 'stuff');
    $tree->add_data('bar', 'more');
    $tree->add_data('bar', 'stuff');

    foreach my $word (qw/foo bar baz/) {
    if ($tree->has_word($word)) {
        print "$word:" . $tree->get_data($word) . "\n";
    } else {
        print "$word: not found\n";
    }

DESCRIPTION

Top

This module provides perl binding over a native implementation of a letter tree, allowing to index any kind of perl scalar variable by a large set of string with a reduced memory footprint over native perl hashes by sharing their prefixes.

METHODS

Top

new()

Creates and returns a new Data::LetterTree object.

$tree->add_data($word, $data)

Add $word in the tree, pushing $data in indexed values.

$tree->has_word($word)

Return a true value if $word is present in the tree.

$tree->get_data($word)

Return all values indexed by $word as a list.

AUTHOR

Top

Guillaume Rousse, <Guillaume.Rousse@inria.fr>

ACKNOWLEDGEMENTS

Top

Many thanks to Sebastien Aperghis-Tramoni and Rafaël Garcia-Suarez for helping me with in my first XS steps...

COPYRIGHT AND LICENSE

Top


Data-LetterTree documentation  | view source Contained in the Data-LetterTree distribution.