Localize/Auto.pm

filter: Statementstmt 93.3% 14 / 15 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 90.9% 20 / 22 CC 2 SCAR 3.5
CC
2
Cov
88%
localize_for
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Localize/Storage.pm ↑ Summary Localize/Format.pm »
1 package Data::Localize::Auto;
2 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use Data::Localize;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 if (Data::Localize::DEBUG) {
6 require Data::Localize::Log;
7 Data::Localize::Log->import;
8 }
9 }
10  
11 2 extends 'Data::Localize::Localizer';
12  
13 3 ▶sub localize_for {
Subroutine localize_for: called CC=2 SCAR=7.2
Pod documented
14 3 my ($self, %args) = @_;
15 3 my ($id, $args) = @args{ qw(id args) };
16  
17 3 my $value = $id;
18 3 if (Data::Localize::DEBUG()) {
19 print STDERR "[Data::Localize::Auto]: localize_for - $id -> ",
20 defined($value) ? $value : '(null)', "\n";
21 }
22 3 ▶ return $self->format_string('auto', $value, @$args) if $value;
Branch: 1 branch
BranchTrueFalseTotal
if $value 3 0 3
23 0 return ();
24 }
25  
26 2 1;
27  
28 =head1 NAME
29  
30 Data::Localize::Auto - Fallback Localizer
31  
32 =head1 SYNOPSIS
33  
34 # Internal use only
35  
36 =head1 METHODS
37  
38 =head2 register
39  
40 =head2 get_lexicon
41  
42 Does nothing
43  
44 =head2 localize_for
45  
46 Uses the string ID as the localization source
47  
48 =head1 AUTHOR
49  
50 Daisuke Maki C<< <daisuke@endeworks.jp> >>
51  
52 =head1 COPYRIGHT
53  
54 =over 4
55  
56 =item The "MIT" License
57  
58 Permission is hereby granted, free of charge, to any person obtaining a
59 copy of this software and associated documentation files (the
60 "Software"), to deal in the Software without restriction, including
61 without limitation the rights to use, copy, modify, merge, publish,
62 distribute, sublicense, and/or sell copies of the Software, and to
63 permit persons to whom the Software is furnished to do so, subject to
64 the following conditions:
65  
66 The above copyright notice and this permission notice shall be included
67 in all copies or substantial portions of the Software.
68  
69 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
70 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
71 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
72 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
73 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
74 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
75 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
76  
77 =back
78  
79 =cut
« Localize/Storage.pm ↑ Summary Localize/Format.pm »