blib/lib/Template/Plugin/Text/Greeking.pm

filter: Statementstmt 100% 35 / 35 Branchbran 83.3% 5 / 6 Conditioncond 75.0% 3 / 4 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 94.6% 53 / 56 CC 7 SCAR 11.9
CC
7
Cov
96%
__ANON__
6.0
new
2.0
BEGIN
1.0
CRAP 3.3
↑ Summary
1 package Template::Plugin::Text::Greeking;
2  
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use v5.8.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use base "Template::Plugin";
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Text::Greeking;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use UNIVERSAL::require;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 our $VERSION = '1.0';
12  
13 2 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
14 2 my ($class, $context, $options) = @_;
15 2 my $greeking_class = "Text::Greeking";
16 2 ▶ $options ||= { lang => "en" };
Condition50%1/2
$options ||= {"lang", "en"}
l!l
02
MC/DC0%0/1
$options ||= {"lang", "en"}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
17 2 ▶ return sub {
Subroutine __ANON__: called CC=6 SCAR=17.9
18 2 ▶ my $opt = { %$options, %{ $_[0] || {} } };
Condition100%2/2
$_[0] || {}
l!l
11
MC/DC100%1/1
$_[0] || {}
$_[0]
Truth table100%2/2
A
A= $_[0]
Aresult
11
00
19  
20 2 ▶ if ($opt) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt) 2 0 2
21 2 ▶ if ($opt->{lang} eq 'zh_TW') {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt->{"lang"} eq "zh_TW") 1 1 2
22 1 $greeking_class = "Text::Greeking::zh_TW";
23 }
24 }
25  
26 2 $greeking_class->require();
27 2 my $g = $greeking_class->new;
28 2 for (qw(words paragraphs sentences)) {
29 6 ▶ if ($opt->{$_}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt->{$_}) 1 5 6
30 1 $g->$_(@{ $opt->{$_} })
31 }
32 }
33 $g->generate()
34 2 };
35 }
36  
37 4 1; # Magic true value required at end of module
38 __END__
↑ Summary