Translate.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 89.7% 35 / 39 CC 2 SCAR 2.5
CC
2
Cov
93%
get_translator
2.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary Translate/Babelfish.pm »
1 3 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Text::Pipe::Translate;
6 3 our $VERSION = '1.100890';
7 # ABSTRACT: Translate text from one language to another
8 3 ▶use Lingua::Translate;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use parent qw(Text::Pipe::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 __PACKAGE__->mk_scalar_accessors(qw(from to translators));
11 3 ▶use constant DEFAULTS => (translators => {},);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶sub get_translator {
Subroutine get_translator: called CC=2 SCAR=8.1
Pod documented
14 1 my $self = shift;
15 1 ▶ $self->translators->{ $self->from }{ $self->to } ||=
Condition33%1/3
$self->translators->{$self->from}{$self->to} ||= "Lingua::Translate"->new("src", $self->from, "dest", $self->to)
l!l&&r!l&&!r
010
MC/DC0%0/2
$self->translators->{$self->from}{$self->to} ||= "Lingua::Translate"->new("src", $self->from, "dest", $self->to)
$self->translators->{$self->from}{$self->to} "Lingua::Translate"->new("src", $self->from, "dest", $self->to)
Truth table33%1/3
A ||= B
A= $self->translators->{$self->from}{$self->to}B= "Lingua::Translate"->new("src", $self->from, "dest", $self->to)
ABresult
1X1
011
000
16 Lingua::Translate->new(src => $self->from, dest => $self->to);
17 }
18  
19 1 ▶sub filter_single {
Subroutine filter_single: called CC=1 SCAR=0.0
Pod documented
20 1 my ($self, $input) = @_;
21 1 $self->get_translator->translate($input);
22 }
23 3 1;
24  
25  
26 __END__
↑ Summary Translate/Babelfish.pm »