| 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)
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)
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||