| 1 | package Rose::HTML::Object::Localized; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 43 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 43 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 43 | ▶ | use Rose::HTML::Object::Message::Localizer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 43 | ▶ | use base 'Rose::Object'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 43 | our $VERSION = '0.600'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | #our $Debug = 0; | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | use Rose::HTML::Object::MakeMethods::Localization | ||||||||||||||||||||||||||||
| 15 | 43 | ▶ | ( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 43 | localized_errors => | |||||||||||||||||||||||||||
| 17 | [ | ||||||||||||||||||||||||||||
| 18 | 'errors', | ||||||||||||||||||||||||||||
| 19 | ], | ||||||||||||||||||||||||||||
| 20 | 43 | ); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | use Rose::Class::MakeMethods::Generic | ||||||||||||||||||||||||||||
| 23 | 43 | ▶ | ( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 43 | inheritable_scalar => | |||||||||||||||||||||||||||
| 25 | [ | ||||||||||||||||||||||||||||
| 26 | 'default_localizer', | ||||||||||||||||||||||||||||
| 27 | 'default_locale', | ||||||||||||||||||||||||||||
| 28 | ], | ||||||||||||||||||||||||||||
| 29 | 43 | ); | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | sub localizer | ||||||||||||||||||||||||||||
| 32 | 230 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
localizer: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 230 | my($invocant) = shift; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | # Called as object method | ||||||||||||||||||||||||||||
| 36 | 230 | ▶ | if(my $class = ref $invocant) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | { | ||||||||||||||||||||||||||||
| 38 | 209 | ▶ | if(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||
| 40 | 0 | return $invocant->{'localizer'} = shift; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 209 | ▶ | return $invocant->{'localizer'} || $class->default_localizer; | ||||||||||||||||||||||||||
|
Condition33%1/3
$invocant->{'localizer'} || $class->default_localizer
MC/DC0%0/2
$invocant->{'localizer'} || $class->default_localizer
$invocant->{'localizer'}
$class->default_localizer
Truth table33%1/3
A || B
A= $invocant->{'localizer'}B= $class->default_localizer
| |||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | else # Called as class method | ||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||
| 47 | 21 | ▶ | if(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||
| 49 | 2 | return $invocant->default_localizer(@_); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 19 | return $invocant->default_localizer | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub locale | ||||||||||||||||||||||||||||
| 57 | 94 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
locale: called CC=11 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 58 | 94 | my($invocant) = shift; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | # Called as an object method | ||||||||||||||||||||||||||||
| 61 | 94 | ▶ | if(my $class = ref $invocant) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||
| 63 | 93 | ▶ | if(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | { | ||||||||||||||||||||||||||||
| 65 | 15 | return $invocant->{'locale'} = shift; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 78 | ▶ | return $invocant->{'locale'} if($invocant->{'locale'}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 47 | foreach my $parent_name (qw(parent_group parent_field parent_form parent)) | |||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||
| 72 | 184 | ▶ | if($invocant->can($parent_name) && (my $parent = $invocant->$parent_name())) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$invocant->can($parent_name) and my $parent = $invocant->$parent_name
MC/DC100%2/2
$invocant->can($parent_name) and my $parent = $invocant->$parent_name
$invocant->can($parent_name)
my $parent = $invocant->$parent_name
Truth table100%3/3
A and B
A= $invocant->can($parent_name)B= my $parent = $invocant->$parent_name
| |||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||
| 74 | 4 | my $locale = $parent->locale; | |||||||||||||||||||||||||||
| 75 | 4 | ▶ | return $locale if(defined $locale); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 43 | ▶ | return $invocant->localizer->locale || $invocant->localizer->default_locale; | ||||||||||||||||||||||||||
|
Condition33%1/3
$invocant->localizer->locale || $invocant->localizer->default_locale
MC/DC0%0/2
$invocant->localizer->locale || $invocant->localizer->default_locale
$invocant->localizer->locale
$invocant->localizer->default_locale
Truth table33%1/3
A || B
A= $invocant->localizer->localeB= $invocant->localizer->default_locale
| |||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | else # Called as a class method | ||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||
| 83 | 1 | ▶ | if(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | { | ||||||||||||||||||||||||||||
| 85 | 0 | return $invocant->default_locale(shift); | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 1 | ▶ | return $invocant->localizer->locale || $invocant->default_locale; | ||||||||||||||||||||||||||
|
Condition33%1/3
$invocant->localizer->locale || $invocant->default_locale
MC/DC0%0/2
$invocant->localizer->locale || $invocant->default_locale
$invocant->localizer->locale
$invocant->default_locale
Truth table33%1/3
A || B
A= $invocant->localizer->localeB= $invocant->default_locale
| |||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 43 | 1; | |||||||||||||||||||||||||||