| 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"}
MC/DC0%0/1
$options ||= {"lang", "en"}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||
| 17 | 2 | ▶ | return sub { | ||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| |||||||||||||
| 18 | 2 | ▶ | my $opt = { %$options, %{ $_[0] || {} } }; | ||||||||||
|
Condition100%2/2
$_[0] || {}
MC/DC100%1/1
$_[0] || {}
$_[0]
Truth table100%2/2
A
A= $_[0]
| |||||||||||||
| 19 | |||||||||||||
| 20 | 2 | ▶ | if ($opt) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | 2 | ▶ | if ($opt->{lang} eq 'zh_TW') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 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__ | ||||||||||||