File Coverage

blib/lib/Data/Localize/Auto.pm
Criterion Covered Total %
statement 12 13 92.3
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 18 20 90.0


line stmt bran cond sub pod time code
1             package Data::Localize::Auto;
2 1     1   7 use Moo;
  1         1  
  1         8  
3 1     1   329 use Data::Localize;
  1         2  
  1         44  
4             BEGIN {
5 1     1   170 if (Data::Localize::DEBUG) {
6             require Data::Localize::Log;
7             Data::Localize::Log->import;
8             }
9             }
10              
11             extends 'Data::Localize::Localizer';
12              
13             sub localize_for {
14 1     1 1 19 my ($self, %args) = @_;
15 1         4 my ($id, $args) = @args{ qw(id args) };
16              
17 1         3 my $value = $id;
18 1         2 if (Data::Localize::DEBUG()) {
19             print STDERR "[Data::Localize::Auto]: localize_for - $id -> ",
20             defined($value) ? $value : '(null)', "\n";
21             }
22 1 50       11 return $self->format_string('auto', $value, @$args) if $value;
23 0           return ();
24             }
25              
26             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<< >>
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