GedNav

 view release on metacpan or  search on metacpan

outline.pl  view on Meta::CPAN

#!/usr/local/bin/perl

use CGI;
use Data::Dumper;
use File::Basename;
use Roman;

use strict;

use GedNav::Menu;
use GedNav;

##  This script is provided as an example.
##  It doesn't wrap lines or paginate, but you get what you pay for...  :)

my $filename = shift || 'royal92';
my $indicode = shift || 'I52';

my $dataset = new GedNav($filename);

my $primary = $dataset->get_indi($indicode);

printf "Descendant Tree: %s\n\n", $primary->name_normal;

print &do_indi($primary, 0, basename($primary->dataset));

print "\n\n";

exit;

sub do_indi
{
   my $indi = shift;
   my $depth = shift;
   my $dataset = shift;
   my $label = shift;

   my $html = '';

   $html .= sprintf "%s%s%s -- ",
	'. . ' x $depth,
	($label) ? "$$label. " : '',
	$indi->name_normal,
	;

   $html .= sprintf "b: %s, ", $indi->birth->date if $indi->birth;
   $html .= sprintf "d: %s, ", $indi->death->date if $indi->death;

   $html .= "\n";

   my $childcount = 0;
   foreach ($indi->fams)
   {
      $html .= &do_fam($_, $depth, $indi->sex, $dataset, \$childcount);
   }

   return $html;
}

sub do_fam
{
   my $fam = shift;
   my $depth = shift;
   my $sex = shift;
   my $dataset = shift;
   my $childcount = shift;

   my $text = '';

   my $spouse = ($sex =~ /f/i) ? $fam->husb : $fam->wife;



( run in 1.521 second using v1.01-cache-2.11-cpan-39bf76dae61 )