NAME

Tree::Family - Represent and visualize a family tree.

SYNOPSIS

use Tree::Family;

my $tree = Tree::Family->new(filename => '/tmp/mytree.dmp');

my $person = Tree::Family::Person->new(name => 'Fred');
my $nother = Tree::Family::Person->new(name => 'Wilma');

$person->spouse($nother);

$tree->add_person($person);
$tree->add_person($nother);

for ($tree->people) {
    print $_->name;
}

my $dot_file = $tree->as_dot;

DESCRIPTION

Use this module to represent spousal and parental relationships among a group of people, and generate a graphviz "dot" file to visualize them.

FUNCTIONS

new

my $tree = Tree::Family->new(filename => '/tmp/foobarfamily.dmp');

write

Write the family tree to a file

$tree->write

add_person

Add a person to the tree

$tree->add_person($joe);

$joe should be a Tree::Family::Person object.

delete_person

Delete a person

$tree->delete_person($joe)

people

Get a list of all the people in the tree

find

Find a person, specifying keys and values to search for.

$tree->find(id => 'sam');

$tree->find(first_name => 'joe', last_name => 'dimaggio');

min_generation

The numeric smallest generation.

max_generation

The numeric highest generation.

write_dotfile

Write out a .dot file (graphviz format).

$tree->write("output.dot");

as_dot

Return the text for a .dot graphviz file

print $tree->as_dot

SEE ALSO

Tree::Family::Person
family.cgi (in this distribution)

AUTHOR

Brian Duggan, <bduggan at matatu.org>

BUGS

graphviz uses a lot of heuristics to create a nice layout. This package attempts to micro-manage the contents of the dot file in order to produce a nice layout, while still letting graphviz do the brunt of the work. This approach doesn't always produce optimal results. Patches welcome.

COPYRIGHT & LICENSE

Copyright 2006 Brian Duggan, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.