FormHandler/TraitFor/I18N.pm

filter: Statementstmt 93.5% 29 / 31 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 83.6% 41 / 49 CC 5 SCAR 11.6
CC
5
Cov
85%
_build_language_handle
5.8
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« FormHandler/Field/TextCSV.pm ↑ Summary FormHandler/Field/Compound.pm »
1 package HTML::FormHandler::TraitFor::I18N;
2 # ABSTRACT: localization
3 147 $HTML::FormHandler::TraitFor::I18N::VERSION = '0.410002';
4 147 ▶use HTML::FormHandler::I18N;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 147 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 147 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 147 has 'language_handle' => (
10 isa => duck_type( [ qw(maketext) ] ),
11 is => 'rw',
12 lazy_build => 1,
13 required => 1,
14 );
15  
16 145 ▶sub _build_language_handle {
Subroutine _build_language_handle: called CC=5 SCAR=17.6
17 145 my ($self) = @_;
18  
19 145 ▶ if (!$self->isa('HTML::FormHandler') && $self->has_form) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->isa("HTML::FormHandler") and $self->has_form) 0 145 145
Condition33%1/3
not $self->isa("HTML::FormHandler") and $self->has_form
!ll&&!rl&&r
14500
MC/DC0%0/2
not $self->isa("HTML::FormHandler") and $self->has_form
not $self->isa("HTML::FormHandler") $self->has_form
Truth table33%1/3
not(A) and B
A= not $self->isa("HTML::FormHandler")B= $self->has_form
ABresult
0X0
100
111
20 0 return $self->form->language_handle();
21 }
22 145 my $lh;
23 145 ▶ if ( $ENV{LANGUAGE_HANDLE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'LANGUAGE_HANDLE'}) { } 31 114 145
24 31 ▶ if ( blessed $ENV{LANGUAGE_HANDLE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($ENV{'LANGUAGE_HANDLE'})) { } 0 31 31
25 0 $lh = $ENV{LANGUAGE_HANDLE};
26 }
27 else {
28 31 $lh = HTML::FormHandler::I18N->get_handle( $ENV{LANGUAGE_HANDLE} );
29 }
30 }
31 else {
32 114 $lh = HTML::FormHandler::I18N->get_handle;
33 }
34 145 return $lh;
35 }
36  
37 20 ▶sub _localize {
Subroutine _localize: called CC=1 SCAR=0.0
38 20 my ($self, @message) = @_;
39 20 my $message = $self->language_handle->maketext(@message);
40 20 return $message;
41 }
42  
43 147 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 147 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 147 1;
47  
48 __END__
« FormHandler/Field/TextCSV.pm ↑ Summary FormHandler/Field/Compound.pm »