File Coverage

blib/lib/Ftree/FamilyTreeDataFactory.pm
Criterion Covered Total %
statement 12 69 17.3
branch 0 14 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 89 17.9


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   6 use strict;
  1         2  
  1         30  
25 1     1   5 use warnings;
  1         2  
  1         34  
26              
27 1     1   983 use Switch;
  1         33284  
  1         6  
28 1     1   32676 use CGI::Carp qw(fatalsToBrowser);
  1         2859  
  1         8  
29              
30             sub getFamilyTree {
31 0     0 0   my ( $config ) = @_;
32 0           my $type = $config->{type};
33 0 0         $type = 'csv' if ($type eq 'txt');
34            
35 0           switch ($type) {
  0            
  0            
36 0 0         case 'csv' {
  0            
37 0           require Ftree::DataParsers::ExtendedSimonWardFormat;
38 0           return ExtendedSimonWardFormat::createFamilyTreeDataFromFile($config->{config});
39 0           }
  0            
  0            
  0            
40 0 0         case 'excel' {
  0            
41 0           require Ftree::DataParsers::ExcelFormat;
42 0           return ExcelFormat::createFamilyTreeDataFromFile($config->{config});
43 0           }
  0            
  0            
  0            
44 0 0         case 'excelx' {
  0            
45 0           require Ftree::DataParsers::ExcelxFormat;
46 0           return ExcelxFormat::createFamilyTreeDataFromFile($config->{config});
47 0           }
  0            
  0            
  0            
48 0 0         case 'ser' {
  0            
49 0           require Ftree::DataParsers::SerializerFormat;
50 0           return SerializerFormat::createFamilyTreeDataFromFile($config->{config});
51 0           }
  0            
  0            
  0            
52 0 0         case 'gedcom' {
  0            
53 0           require Ftree::DataParsers::GedcomFormat;
54 0           return GedcomFormat::createFamilyTreeDataFromFile($config->{config});
55 0           }
  0            
  0            
  0            
56 0 0         case 'dbi' {
  0            
57 0           require Ftree::DataParsers::DBIFormat;
58 0           return DBIFormat::getFamilyTreeData($config->{config});
59 0           }
  0            
  0            
  0            
60 0           else {croak "Unknown type: $type" }
61 0           }
62            
63 0           return;
64             }
65              
66             1;