NAME

Tree::Family::Person

SYNOPSIS

my $p = Tree::Family::Person->new(
   first_name => 'Fred',
   last_name   => 'Flintstone',
   birth_date  => '1901-09-01',
   death_date  => undef,
   gender      => 'male',
   birth_place => 'Bedrock');

$p->spouse($wilma);

$p->dad($papa);

$p->mom($mama);

for ($p->kids) {
   print $_->first_name;
}

$p->set(last_name => 'Smith');

new

Create a new person

first_name,middle_name,last_name,birth_date,death_date,birth_place,gender,id,generation

Accessors, mutators

full_name

first + middle + last

set

Set an attribute for a person (same as using mutators above)

$person->set(first_name => 'Joe');

get

Get an attribute

Same as using accessors above.

$person->get('first_name');

spouse

Get/set spouse

$fred->spouse($wilma)

dad

Get/set dad

$luke->dad($darth)

mom

Get/set mom

$pebbles->mom($wilma)

add_kid

Add a kid to a person

$carol->add_kid($jan);
$carol->add_kid($marsha);
$carol->add_kid($cindy);

delete_kid

Remove a kid from a person

$someone->remove_kid($annie)

kids

Return an array of kids

print $_->name for $mike->kids

has_partner

Did $a have any kids with $b?

print $a->has_partner($b) ? 'you betcha' : 'nope'

partners

Get people with whom a person had kids.

find

Find a person based on their attributes

$class->find(first_name => "Bugs", last_name => "Bunny" );

all

Get all people

Tree::Family::Person->all

partners_and_spouse

Get a list of all people with whom a person had kids, and their spouse (if they have one)

min_generation, max_generation

The min/max numeric generation

Freeze, Toast

Used for storage by Data::Dumper.