blib/lib/XML/TMX/Reader.pm

filter: Statementstmt 81.9% 163 / 199 Branchbran 63.2% 62 / 98 Conditioncond 60.0% 30 / 50 MC/DCmcdc 20.6% 6 / 29 Subroutinesub 78.1% 25 / 32 Podpod 100% 6 / 6 totaltotal 70.5% 292 / 414 SCAR 51.5
CC
73
Cov
73%
for_tu
53.9
__ANON__
16.6
__ANON__
8.0
CRAP 172.3
« blib/lib/XML/TMX/FromPO.pm ↑ Summary scripts/tmx2tmx »
1 package XML::TMX::Reader;
2 6 $XML::TMX::Reader::VERSION = '0.35';
3 # ABSTRACT: Perl extension for reading TMX files
4  
5 6 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 6 ▶use XML::DT;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶use XML::TMX::Writer;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use File::BOM qw( open_bom);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 6 our @ISA = 'Exporter';
15 6 our @EXPORT_OK = qw();
16  
17  
18 sub new {
19 8 ▶ my ($class, $file) = @_;
Subroutine new: called CC=2 SCAR=6.9
Pod documented
20  
21 8 ▶ return undef unless -f $file;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $file 1 7 8
22 7 my $self = bless {
23 encoding => _guess_encoding($file),
24 filename => $file,
25 ignore_markup => 1,
26 } => $class;
27 7 $self->_parse_header;
28 7 return $self;
29 }
30  
31 sub _guess_encoding {
32 7 ▶ my $file = shift;
Subroutine _guess_encoding: called CC=3 SCAR=11.0
33 7 my $encoding = 'UTF-8';
34 7 my $enc = open_bom (my $fh, $file, ":utf8"); # or die "can't open $file ($!)";
35 7 ▶ $encoding= $enc if $enc;
Branch: 1 branch
BranchTrueFalseTotal
if $enc 0 7 7
36 7 my $line = <$fh>;
37 7 ▶ if ($line =~ /encoding=['"]([^'"]+)['"]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /encoding=['"]([^'"]+)['"]/) 5 2 7
38 5 $encoding = $1;
39 }
40 #print STDERR "Debug: defuse.ENC= $enc; enc=$encoding\n";
41 7 close $fh;
42 7 return $encoding;
43 }
44  
45 16 ▶sub _enc2bin{ my $enc=shift;
Subroutine _enc2bin: called CC=2 SCAR=7.4
46 16 ▶ if($enc =~ /utf.*8/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($enc =~ /utf.*8/i) { } 16 0 16
47 16 $enc = "utf8"
48 }
49 0 else {$enc = "encoding($enc)"}
50 16 return ":$enc";
51 }
52  
53 sub _parse_header {
54 7 ▶ my $self = shift;
Subroutine _parse_header: called CC=1 SCAR=0.0
55  
56 7 my $header = "";
57 {
58 7 my $fh;
59 7 local $/ = "<body>";
60 7 open_bom($fh, $self->{filename},_enc2bin($self->{encoding})) ;# or die "$!";
61 #print STDERR "Debug2: defuse.ENC= $!- ; enc=$self->{encoding}\n";
62 7 $header = <$fh>;
63 7 close $fh;
64 }
65  
66 7 $header =~ s/^.*(<header)/$1/s;
67 7 $header =~ s/(<\/header>).*$/$1/s;
68  
69 7 $header =~ s!(<header[^/]+/>).*$!$1!s;
70  
71 dtstring($header => (
72 'header' => sub {
73 7 ▶ $self->{header}{$_} = $v{$_} for (keys %v);
Subroutine __ANON__: called CC=2 SCAR=6.9
74 },
75 'prop' => sub {
76 16 ▶ $v{type} ||= "_";
Subroutine __ANON__: called CC=2 SCAR=7.1
Condition50%1/2
$XML::TMX::Reader::v{"type"} ||= "_"
l!l
160
MC/DC0%0/1
$XML::TMX::Reader::v{"type"} ||= "_"
$XML::TMX::Reader::v{"type"}
Truth table50%1/2
A
A= $XML::TMX::Reader::v{"type"}
Aresult
11
00
77 16 push @{$self->{header}{-prop}{$v{type}}}, $c;
78 },
79 'note' => sub {
80 16 ▶ push @{$self->{header}{-note}}, $c;
Subroutine __ANON__: called CC=1 SCAR=0.0
81 },
82 7 ));
83 }
84  
85  
86 sub ignore_markup {
87 0 ▶ my ($self, $opt) = @_;
Subroutine ignore_markup: not called CC=2 SCAR=17.9
Pod documented
88 0 ▶ $opt = 1 unless defined $opt;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $opt 0 0 0
89 0 $self->{ignore_markup} = $opt;
90 }
91  
92  
93 sub languages {
94 2 ▶ my $self = shift;
Subroutine languages: called CC=1 SCAR=0.0
Pod documented
95 2 my %languages = ();
96 $self->for_tu({proc_tu => 100},
97 sub {
98 13 ▶ my $tu = shift;
Subroutine __ANON__: called CC=3 SCAR=11.0
99 13 for ( keys %$tu ) {
100 52 ▶ $languages{$_}++ unless m/^-/;
Branch: 1 branch
BranchTrueFalseTotal
unless /^-/ 26 26 52
101 }
102 2 } );
103 2 return keys %languages;
104 }
105  
106  
107 sub _merge_notes {
108 12 ▶ my ($orig, $new) = @_;
Subroutine _merge_notes: called CC=4 SCAR=13.9
109  
110 12 ▶ $orig //= [];
Condition100%2/2
$orig //= []
l!l
75
MC/DC100%1/1
$orig //= []
$orig
Truth table100%2/2
A
A= $orig
Aresult
11
00
111 12 ▶ $orig = [$orig] unless ref $orig eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $orig eq "ARRAY" 5 7 12
112 12 ▶ $new = [$new] unless ref $new eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $new eq "ARRAY" 8 4 12
113  
114 12 push @$orig => grep { my $x = $_; !grep { $x eq $_} @$orig } @$new;
115  
116 12 return $orig;
117 }
118  
119 sub _merge_props {
120 5 ▶ my ($orig, $new) = @_;
Subroutine _merge_props: called CC=6 SCAR=19.6
121 5 ▶ die "-prop should be hash" if $orig and ref $orig ne "HASH";
Branch: 1 branch
BranchTrueFalseTotal
if $orig and ref $orig ne "HASH" 0 5 5
Condition66%2/3
$orig and ref $orig ne "HASH"
!ll&&!rl&&r
140
MC/DC0%0/2
$orig and ref $orig ne "HASH"
$orig ref $orig ne "HASH"
Truth table66%2/3
A and B
A= $origB= ref $orig ne "HASH"
ABresult
0X0
100
111
122 5 ▶ die "-prop should be hash" if $new and ref $new ne "HASH";
Branch: 1 branch
BranchTrueFalseTotal
if $new and ref $new ne "HASH" 0 5 5
Condition33%1/3
$new and ref $new ne "HASH"
!ll&&!rl&&r
050
MC/DC0%0/2
$new and ref $new ne "HASH"
$new ref $new ne "HASH"
Truth table33%1/3
A and B
A= $newB= ref $new ne "HASH"
ABresult
0X0
100
111
123  
124 5 for my $key (keys %$new) {
125 6 $orig->{$key} = _merge_notes($orig->{$key}, $new->{$key});
126 }
127 5 return $orig;
128 }
129  
130 sub _compute_header {
131 4 ▶ my ($current, $conf) = @_;
Subroutine _compute_header: called CC=3 SCAR=12.3
132 4 my %header = %$current;
133 4 ▶ if (exists($conf->{-note})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $conf->{"-note"}) 0 4 4
134 0 $header{-note} = _merge_notes($header{-note}, $conf->{-note});
135 }
136 4 ▶ if (exists($conf->{-prop})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $conf->{"-prop"}) 0 4 4
137 0 $header{-prop} = _merge_props($header{-prop}, $conf->{-prop});
138 }
139 4 return \%header;
140 }
141  
142 sub for_tu {
143 9 ▶ my $self = shift;
Subroutine for_tu: called CC=31 SCAR=39.9
Pod documented
144 9 my $conf = { -header => 1 };
145 9 my $i = 0;
146  
147 9 ▶ ref($_[0]) eq "HASH" and $conf = {%$conf , %{shift(@_)}};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq "HASH" and $conf = {%$conf, %{shift @_;}} 6 3 9
148  
149 9 my $code = shift;
150 9 ▶ die "invalid processor" unless ref($code) eq "CODE";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $code eq "CODE" 0 9 9
151  
152 9 local $/;
153  
154 9 my $outputingTMX = 0;
155 9 my $tmx;
156 my $data;
157 9 my $gen=0;
158 my %h = (
159 -type => { tu => 'SEQ', tuv => 'SEQ' },
160 tu => sub {
161 59 ▶ my $tu;
Subroutine __ANON__: called CC=13 SCAR=28.1
162 59 for my $va (@$c) {
163 306 ▶ if ($va->[0] eq "-prop") {
Branch: 2 branches
BranchTrueFalseTotal
if ($va->[0] eq '-prop') { } 87 219 306
elsif ($va->[0] eq '-note') { } 101 118 219
164 87 push @{$tu->{$va->[0]}{$va->[1]}}, $va->[2]
165 } elsif ($va->[0] eq "-note") {
166 101 push @{$tu->{$va->[0]}}, $va->[1]
167 } else {
168 118 $tu->{$va->[0]} = $va->[1]
169 }
170 }
171 59 my ($ans, $v) = $code->($tu, \%v);
172  
173 # Check if the user wants to create a TMX and
174 # forgot to say us
175 59 ▶ if (!$outputingTMX && $ans && ref($ans) eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (not $outputingTMX and $ans and ref $ans eq "HASH") 0 59 59
Condition83%5/6
not $outputingTMX and $ans and ref $ans eq "HASH"
!ll&&!rl&&r
42170
not $outputingTMX and $ans
!ll&&!rl&&r
261617
MC/DC0%0/3
not $outputingTMX and $ans and ref $ans eq "HASH"
not $outputingTMX $ans ref $ans eq "HASH"
Truth table75%3/4
not(A) and B and C
A= not $outputingTMXB= $ansC= ref $ans eq "HASH"
ABCresult
0XX0
10X0
1100
1111
176 0 $outputingTMX = 1;
177 0 $tmx = XML::TMX::Writer->new();
178 0 ▶ if ($conf->{-header}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"-header"}) 0 0 0
179 0 my $header = _compute_header($self->{header}, $conf);
180 0 $tmx->start_tmx(encoding => $self->{encoding}, %$header);
181 }
182 }
183 # Add the translation unit
184 59 ▶ if ($ans && ref($ans) eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if ($ans and ref $ans eq "HASH") 20 39 59
Condition100%3/3
$ans and ref $ans eq "HASH"
!ll&&!rl&&r
221720
MC/DC100%2/2
$ans and ref $ans eq "HASH"
$ans ref $ans eq "HASH"
Truth table100%3/3
A and B
A= $ansB= ref $ans eq "HASH"
ABresult
0X0
100
111
185 20 $gen++;
186 20 ▶ %v = %$v if ($v && ref($v) eq "HASH");
Branch: 1 branch
BranchTrueFalseTotal
if $v and ref $v eq "HASH" 0 20 20
Condition33%1/3
$v and ref $v eq "HASH"
!ll&&!rl&&r
2000
MC/DC0%0/2
$v and ref $v eq "HASH"
$v ref $v eq "HASH"
Truth table33%1/3
A and B
A= $vB= ref $v eq "HASH"
ABresult
0X0
100
111
187  
188 20 my %ans = (%v, %$ans);
189 20 ▶ $ans{"-n"}=$i if $conf->{n} ;
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"n"} 0 20 20
190 20 $tmx->add_tu(-verbatim => $conf->{-verbatim}, %ans);
191 }
192 },
193  
194 tuv => sub {
195 118 ▶ my $tuv;
Subroutine __ANON__: called CC=7 SCAR=20.8
196 118 for my $v (@$c) {
197 154 ▶ if ($v->[0] eq "-prop") {
Branch: 3 branches
BranchTrueFalseTotal
if ($v->[0] eq '-prop') { } 18 136 154
elsif ($v->[0] eq '-note') { } 18 118 136
elsif ($v->[0] eq '-cdata') { } 0 118 118
198 18 push @{$tuv->{$v->[0]}{$v->[1]}}, $v->[2]
199 } elsif ($v->[0] eq "-note") {
200 18 push @{$tuv->{$v->[0]}}, $v->[1]
201 } elsif ($v->[0] eq "-cdata") {
202 0 $tuv->{-iscdata} = 1;
203 0 $tuv->{-seg} = $v->[1];
204 } else {
205 118 $tuv->{-seg} = $v->[0];
206 }
207 }
208 118 ▶ [ $v{lang} || $v{'xml:lang'} || "_" => $tuv ]
Condition40%2/5
$XML::TMX::Reader::v{'lang'} || $XML::TMX::Reader::v{'xml:lang'} || '_'
l!l
1180
$XML::TMX::Reader::v{"lang"} or $XML::TMX::Reader::v{"xml:lang"}
l!l&&r!l&&!r
01180
MC/DC0%0/2
$XML::TMX::Reader::v{'lang'} || $XML::TMX::Reader::v{'xml:lang'} || '_'
$XML::TMX::Reader::v{"lang"} $XML::TMX::Reader::v{"xml:lang"}
Truth table33%1/3
A or B
A= $XML::TMX::Reader::v{"lang"}B= $XML::TMX::Reader::v{"xml:lang"}
ABresult
1X1
011
000
209 },
210 105 ▶ prop => sub { ["-prop", $v{type} || "_", $c] },
Subroutine __ANON__: called CC=2 SCAR=7.6
Condition50%1/2
$XML::TMX::Reader::v{'type'} || '_'
l!l
1050
MC/DC0%0/1
$XML::TMX::Reader::v{'type'} || '_'
$XML::TMX::Reader::v{'type'}
Truth table50%1/2
A
A= $XML::TMX::Reader::v{'type'}
Aresult
11
00
211 119 ▶ note => sub { ["-note" , $c] },
Subroutine __ANON__: called CC=1 SCAR=0.0
212 seg => sub {
213 118 ▶ return ($v{iscdata}) ? [ -cdata => $c ] : [ $c ]
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$XML::TMX::Reader::v{'iscdata'} ? : 0 118 118
214 },
215 -cdata => sub {
216 0 ▶ father->{'iscdata'} = 1; $c },
Subroutine __ANON__: not called CC=1 SCAR=6.9
217 0 ▶ hi => sub { $self->{ignore_markup}?$c:toxml },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_markup'} ? : 0 0 0
218 0 ▶ ph => sub { $self->{ignore_markup}?$c:toxml },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$self->{'ignore_markup'} ? : 0 0 0
219 9 );
220  
221  
222 9 $/ = "\n";
223  
224 9 $h{-outputenc} = $h{-inputenc} = $self->{encoding};
225  
226 9 my $resto = "";
227 ## Go through the header...
228 9 my $fh;
229 9 open_bom($fh, $self->{filename},_enc2bin($self->{encoding})) ;# or die "$!";
230 #print STDERR "Debug2: defuse.ENC= $! ; enc=" ,_enc2bin($self->{encoding}),"\n";
231 9 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 87 0 87
232 87 ▶ next if /^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\s*$/ 12 75 87
233 75 ▶ last if /<body\b/;
Branch: 1 branch
BranchTrueFalseTotal
if /<body\b/ 9 66 75
234 }
235  
236 9 ▶ if (m!(.*?)(<body.*?>)(.*)!s) {
Branch: 1 branch
BranchTrueFalseTotal
if (/(.*?)(<body.*?>)(.*)/s) 9 0 9
237 9 $resto = $3;
238 }
239  
240  
241 # If we have an output filename, user wants to output a TMX
242 9 ▶ $conf->{-output} = $conf->{output} if defined($conf->{output});
Branch: 1 branch
BranchTrueFalseTotal
if defined $conf->{"output"} 3 6 9
243 9 ▶ if (defined($conf->{-output})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $conf->{"-output"}) 4 5 9
244 4 $outputingTMX = 1;
245 4 $tmx = XML::TMX::Writer->new();
246 4 ▶ if ($conf->{-header}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"-header"}) 4 0 4
247 4 my $header = _compute_header($self->{header}, $conf);
248 $tmx->start_tmx(encoding => $self->{encoding},
249 -output => $conf->{-output},
250 4 %$header);
251 }
252 }
253  
254 9 $/ = "</tu>";
255 9 ▶ $conf->{-verbose}++ if $conf->{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"verbose"} 0 9 9
256 9 ▶ print STDERR "." if $conf->{-verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"-verbose"} 0 9 9
257 9 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 68 0 68
258 68 ▶ ($_ = $resto . $_ and $resto = "" ) if $resto;
Branch: 1 branch
BranchTrueFalseTotal
if $resto 9 59 68
Condition50%3/6
$resto && (($_ = $resto . $_) && ($resto = ''))
!ll&&!rl&&r
5990
$_ = $resto . $_ and $resto = ""
!ll&&!rl&&r
090
MC/DC0%0/3
$resto && (($_ = $resto . $_) && ($resto = ''))
$resto $_ = $resto . $_ $resto = ""
Truth table0%0/4
A && B and C
A= $restoB= $_ = $resto . $_C= $resto = ""
ABCresult
0XX0
10X0
1100
1111
259 68 ▶ last if /<\/body>/;
Branch: 1 branch
BranchTrueFalseTotal
if m[</body>] 8 60 68
260 60 $i++;
261 60 ▶ print STDERR "\r$i" if $conf->{-verbose} && !($i % 10);
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"-verbose"} and not $i % 10 0 60 60
Condition33%1/3
$conf->{"-verbose"} and not $i % 10
!ll&&!rl&&r
6000
MC/DC0%0/2
$conf->{"-verbose"} and not $i % 10
$conf->{"-verbose"} not $i % 10
Truth table33%1/3
A and not(B)
A= $conf->{"-verbose"}B= not $i % 10
ABresult
0X0
100
111
262 60 ▶ last if defined $conf->{proc_tu} && $i > $conf->{proc_tu} ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $conf->{"proc_tu"} and $i > $conf->{"proc_tu"} 1 59 60
Condition100%3/3
defined $conf->{"proc_tu"} and $i > $conf->{"proc_tu"}
!ll&&!rl&&r
40191
MC/DC100%2/2
defined $conf->{"proc_tu"} and $i > $conf->{"proc_tu"}
defined $conf->{"proc_tu"} $i > $conf->{"proc_tu"}
Truth table100%3/3
A and B
A= defined $conf->{"proc_tu"}B= $i > $conf->{"proc_tu"}
ABresult
0X0
100
111
263 59 ▶ last if defined $conf->{gen_tu} && $gen > $conf->{gen_tu};
Branch: 1 branch
BranchTrueFalseTotal
if defined $conf->{"gen_tu"} and $gen > $conf->{"gen_tu"} 0 59 59
Condition66%2/3
defined $conf->{"gen_tu"} and $gen > $conf->{"gen_tu"}
!ll&&!rl&&r
5360
MC/DC0%0/2
defined $conf->{"gen_tu"} and $gen > $conf->{"gen_tu"}
defined $conf->{"gen_tu"} $gen > $conf->{"gen_tu"}
Truth table66%2/3
A and B
A= defined $conf->{"gen_tu"}B= $gen > $conf->{"gen_tu"}
ABresult
0X0
100
111
264 59 ▶ next if defined $conf->{patt} && !m/$conf->{patt}/ ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $conf->{"patt"} and not /$conf->{"patt"}/ 0 59 59
Condition33%1/3
defined $conf->{"patt"} and not /$conf->{"patt"}/
!ll&&!rl&&r
5900
MC/DC0%0/2
defined $conf->{"patt"} and not /$conf->{"patt"}/
defined $conf->{"patt"} not /$conf->{"patt"}/
Truth table33%1/3
A and not(B)
A= defined $conf->{"patt"}B= not /$conf->{"patt"}/
ABresult
0X0
100
111
265 ####
266 # This can't be done. Not sure why it was being done.
267 # So, please, unless you know the implications for tagged crpora
268 # do not uncomment it.
269 # s/\>\s+/>/;
270 59 undef($data);
271 59 ▶ if ($conf->{'-raw'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'-raw'}) { } 0 59 59
272 0 my $ans = $code->($_);
273 0 ▶ if ($conf->{-output}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"-output"}) 0 0 0
274 0 ▶ $ans->{"-n"}=$i if $conf->{n} ;
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"n"} 0 0 0
275 0 $tmx->add_tu(-raw => $ans);
276 }
277 } else {
278 59 eval { dtstring($_, %h) } ; ## dont die in invalid XML
279 59 ▶ warn $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 59 59
280 }
281 }
282 9 ▶ print STDERR "\r$i\n" if $conf->{-verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"-verbose"} 0 9 9
283 9 close $fh;
284  
285  
286 9 ▶ $tmx->end_tmx if $conf->{-header} && $outputingTMX;
Branch: 1 branch
BranchTrueFalseTotal
if $conf->{"-header"} and $outputingTMX 4 5 9
Condition66%2/3
$conf->{"-header"} and $outputingTMX
!ll&&!rl&&r
054
MC/DC50%1/2
$conf->{"-header"} and $outputingTMX
$conf->{"-header"} $outputingTMX
Truth table66%2/3
A and B
A= $conf->{"-header"}B= $outputingTMX
ABresult
0X0
100
111
287 }
288  
289  
290 sub to_html {
291 0 ▶ my $self = shift;
Subroutine to_html: not called CC=1 SCAR=6.9
Pod documented
292 0 my %opt = @_;
293 0 my @ls=$self->languages;
294 0 my $html="<table><tr>". join("\n",map{"<td>$_</td>"} @ls) ."</tr>\n";
295 $self->for_tu(sub {
296 0 ▶ my ($langs, $opts) = @_;
Subroutine __ANON__: not called CC=2 SCAR=17.9
297 0 my $ret = ""; # "<table>";
298 0 for (@ls) { $ret .= "\n\t<td l='$_'>$langs->{$_}{-seg}</td>"}
299  
300 #if ($opt{icons}) {
301 # $ret .= "<img src=\"/icons/flags/".lc($_).".png\" alt=\"$_\"/>"
302 # } else {
303 # $ret .= "$_"
304 # }
305 # $ret .= "</td><td>$langs->{$_}{-seg}</td></tr>\n"
306 0 $html.= "<tr>$ret\n</tr>\n";
307 0 return ""
308 }
309 0 );
310 0 return $html;
311 }
312  
313 sub for_tu2 {
314 0 ▶ warn "Please update your code to use 'for_tu'\n";
Subroutine for_tu2: not called CC=1 SCAR=6.9
Pod documented
315 0 &for_tu;
316 }
317  
318  
319 6 1;
320  
321 __END__
« blib/lib/XML/TMX/FromPO.pm ↑ Summary scripts/tmx2tmx »