File Coverage

blib/lib/Ftree/FamilyTreeDataFactory.pm
Criterion Covered Total %
statement 15 72 20.8
branch 0 14 0.0
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 20 93 21.5


line stmt bran cond sub pod time code
1             #######################################################
2             #
3             # Family Tree generation program, v2.0
4             # Written by Ferenc Bodon and Simon Ward, March 2000 (simonward.com)
5             # Copyright (C) 2000 Ferenc Bodon, Simon K Ward
6             #
7             # This program is free software; you can redistribute it and/or
8             # modify it under the terms of the GNU General Public License
9             # as published by the Free Software Foundation; either version 2
10             # of the License, or (at your option) any later version.
11             #
12             # This program is distributed in the hope that it will be useful,
13             # but WITHOUT ANY WARRANTY; without even the implied warranty of
14             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15             # GNU General Public License for more details.
16             #
17             # For a copy of the GNU General Public License, visit
18             # http://www.gnu.org or write to the Free Software Foundation, Inc.,
19             # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20             #
21             #######################################################
22              
23             package Ftree::FamilyTreeDataFactory;
24 1     1   5 use strict;
  1         1  
  1         27  
25 1     1   6 use warnings;
  1         1  
  1         31  
26 1     1   5 use version; our $VERSION = qv('2.3.30');
  1         1  
  1         8  
27              
28 1     1   1105 use Switch;
  1         32218  
  1         6  
29 1     1   28618 use CGI::Carp qw(fatalsToBrowser);
  1         3018  
  1         8  
30              
31             sub getFamilyTree {
32 0     0 0   my ( $config ) = @_;
33 0           my $type = $config->{type};
34 0 0         $type = 'csv' if ($type eq 'txt');
35            
36 0           switch ($type) {
  0            
  0            
37 0 0         case 'csv' {
  0            
38 0           require Ftree::DataParsers::ExtendedSimonWardFormat;
39 0           return ExtendedSimonWardFormat::createFamilyTreeDataFromFile($config->{config});
40 0           }
  0            
  0            
  0            
41 0 0         case 'excel' {
  0            
42 0           require Ftree::DataParsers::ExcelFormat;
43 0           return ExcelFormat::createFamilyTreeDataFromFile($config->{config});
44 0           }
  0            
  0            
  0            
45 0 0         case 'excelx' {
  0            
46 0           require Ftree::DataParsers::ExcelxFormat;
47 0           return ExcelxFormat::createFamilyTreeDataFromFile($config->{config});
48 0           }
  0            
  0            
  0            
49 0 0         case 'ser' {
  0            
50 0           require Ftree::DataParsers::SerializerFormat;
51 0           return SerializerFormat::createFamilyTreeDataFromFile($config->{config});
52 0           }
  0            
  0            
  0            
53 0 0         case 'gedcom' {
  0            
54 0           require Ftree::DataParsers::GedcomFormat;
55 0           return GedcomFormat::createFamilyTreeDataFromFile($config->{config});
56 0           }
  0            
  0            
  0            
57 0 0         case 'dbi' {
  0            
58 0           require Ftree::DataParsers::DBIFormat;
59 0           return DBIFormat::getFamilyTreeData($config->{config});
60 0           }
  0            
  0            
  0            
61 0           else {croak "Unknown type: $type" }
62 0           }
63            
64 0           return;
65             }
66              
67             1;