Que es codigolibre?
Graphs::Tree
NAME 
Paths::Tree - Generate path from a hash tree.
SYNOPSIS 
#!/usr/bin/perl
my %tree = ( 2 => [3,"HELLO"],
HELLO => ["YOU",WORLD],
"RAIZ" => [1,2],
);
sub show {
my ($child , $level) = @_;
print " " for 0 .. $level; #fifth spaces of level or anything separator;
print "$child \n";
}
use Paths::Tree;
my $n = Paths::Tree->new(-tree=>\%tree,-sub=>\&show);
$n->tree("RAIZ");
RECOMMENDED 
Understanding the Tree's filosofy and how to trace it.
Reach for tree's books.
ABSTRACT 
This example show how to generate itself.
Example tree
(RAIZ) ----> (1)
----> (2) ---->(HELLO)---->(YOU)
---->(WORLD)
DESCRIPTION 
This package provides an object class which can be used to get tree paths , with only pure perl code and I don't use other packet or module cpan.
This class generate the paths of a tree from a base node and return in a method , vals in the execution time (tree).
Technically , the tree is composed of childs ans fhathers linked between them.
PARAMETERS 
$obj->{tree}
Tree hash , the component so strings caracter or numbers. example.
Hash is pass how reference hash.
my %tree = ( 2 => [3,"HELLO"],
HELLO => ["YOU",WORLD],
"RAIZ" => [1,2],
);
$obj->{tree} = \%tree;
$obj->{origin}
Origin node what will begin to recursive process tree.
$obj->{origin} = "A";
$obj->{sub}
Receive parameters from object in execution time.
sub params_receive {
my ($level , $node) = @_;
print " $level , $node \n";
}
$obj->{sub} = \¶ms_receive();
$obj->tree()
This method is the core of object and unique export for use.
Return in execution time two values level and node.
The method is executed and follow is return parameters while recurcive process live.
sub show {
my ($child , $level) = @_;
print " " for 0 .. $level; #fifth spaces of level or anything separator;
print "$child \n";
}
use Paths::Tree;
my $obj = Paths::Tree->new(-tree=>\%tree,-sub=>\&show,-origin=>"RAIZ");
$obj->tree();
GLOBAL PROCESSING 
Using the recursive technique in the object methods.
EXPORT 
This method is exported as follow: tree()
SEE ALSO 
None by default. But can be exported if it's required.
Please report bugs using: <cristian@codigolibre.cl>.
Powerfull features in the future on object method how for example: find_tree() binary_tree().
AUTHOR 
Cristian Vasquez Diaz , cristian@codigolibre.cl.
COPYRIGHT AND LICENSE 
Copyright 2004 by Cristian Vasquez Diaz
This library is free software you can redistribute it and/or modify it under the same terms as Perl itself.