Data::LetterTree.3pm

Langue: en

Version: 2005-12-05 (mandriva - 01/05/08)

Section: 3 (Bibliothèques de fonctions)

NAME

Data::LetterTree - Native letter tree Perl binding

SYNOPSIS

     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

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


new()

Creates and returns a new "Data::LetterTree" object.

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


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

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

$tree->has_word($word)


$tree->has_word($word)

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

$tree->get_data($word)


$tree->get_data($word)

Return all values indexed by $word as a list.

AUTHOR

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

ACKNOWLEDGEMENTS

Many thanks to Sebastien Aperghis-Tramoni and Rafae.l Garcia-Suarez for helping me with in my first XS steps... Copyright (C) 2005 INRIA

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.