File Coverage

blib/lib/Ftree/TextGeneratorFactory.pm
Criterion Covered Total %
statement 15 89 16.8
branch 0 16 0.0
condition n/a
subroutine 5 9 55.5
pod 0 4 0.0
total 20 118 16.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::TextGeneratorFactory;
24 1     1   6 use strict;
  1         2  
  1         33  
25 1     1   5 use warnings;
  1         2  
  1         72  
26              
27 1     1   1740 use Sub::Exporter -setup => { exports => [ qw(init getTextGenerator) ] };
  1         15399  
  1         8  
28             #use Perl6::Export::Attrs;
29 1     1   419 use Switch;
  1         2  
  1         8  
30 1     1   35841 use version; our $VERSION = qv('2.3.30');
  1         2  
  1         10  
31              
32             my $language = "gb";
33             my %langToPict = (
34             hungarian => "hu",
35             english => "gb",
36             german => "de",
37             # spanish => "es",
38             italian => "it",
39             french => "fr",
40             polish => "pl",
41             romanian => "ro",
42             russian => "ru",
43             # slovenian => "si",
44             # japanese => "jp",
45             # chinese => "cn",
46             );
47             my $reverse_name = 0;
48              
49             sub init{
50 0     0 0   ( $language ) = @_;
51             }
52              
53             sub getLangToPict{
54 0     0 0   return %langToPict;
55             }
56             sub get_reverse_name{
57 0     0 0   return $reverse_name;
58             }
59              
60             sub getTextGenerator{
61 0     0 0   switch ($language) {
  0            
  0            
62 0 0         case "hu" {
  0            
63 0           $reverse_name = 1;;
64 0           require Ftree::TextGenerators::HungarianTextGenerator;
65 0           return HungarianTextGenerator->new( );
66 0           }
  0            
  0            
  0            
67 0 0         case "gb" {
  0            
68 0           require Ftree::TextGenerators::EnglishTextGenerator;
69 0           return EnglishTextGenerator->new( );
70 0           }
  0            
  0            
  0            
71 0 0         case "de" {
  0            
72 0           require Ftree::TextGenerators::GermanTextGenerator;
73 0           return GermanTextGenerator->new( );
74 0           }
  0            
  0            
  0            
75 0 0         case "fr" {
  0            
76 0           require Ftree::TextGenerators::FrenchTextGenerator;
77 0           return FrenchTextGenerator->new( );
78 0           }
  0            
  0            
  0            
79 0 0         case "pl" {
  0            
80 0           require Ftree::TextGenerators::PolishTextGenerator;
81 0           return PolishTextGenerator->new( );
82 0           }
  0            
  0            
  0            
83 0 0         case "it" {
  0            
84 0           require Ftree::TextGenerators::ItalianTextGenerator;
85 0           return ItalianTextGenerator->new( );
86 0           }
  0            
  0            
  0            
87 0 0         case "ro" {
  0            
88 0           require Ftree::TextGenerators::RomanianTextGenerator;
89 0           return RomanianTextGenerator->new( );
90 0           }
  0            
  0            
  0            
91 0 0         case "ru" {
  0            
92 0           require Ftree::TextGenerators::RussianTextGenerator;
93 0           return RussianTextGenerator->new( );
94 0           }
  0            
  0            
  0            
95             else {
96 0           require Ftree::TextGenerators::EnglishTextGenerator;
97 0           EnglishTextGenerator->new( );
98             }
99 0           }
100             }
101              
102             1;