File Coverage

blib/lib/Ftree/TextGeneratorFactory.pm
Criterion Covered Total %
statement 12 86 13.9
branch 0 16 0.0
condition n/a
subroutine 4 8 50.0
pod 0 4 0.0
total 16 114 14.0


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