CLI/L10N.pm

filter: Statementstmt 91.3% 21 / 23 Branchbran 50.0% 2 / 4 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 87.5% 7 / 8 Podpod 100% 3 / 3 totaltotal 72.3% 34 / 47 CC 5 SCAR 12.3
CC
5
Cov
73%
_init_handle
7.5
set_language
2.0
loc
2.0
CRAP 3.4
« CLI/Role/CommandSet.pm ↑ Summary CLI/Argument/Number/Int.pm »
1 #=============================================================================
2 #
3 # Module: Term::CLI::L10N
4 #
5 # Author: Steven Bakker (SBAKKER), <sbakker@cpan.org>
6 # Created: 27/02/18
7 #
8 # Copyright (c) 2018 Steven Bakker; All rights reserved.
9 #
10 # This module is free software; you can redistribute it and/or modify
11 # it under the same terms as Perl itself. See "perldoc perlartistic."
12 #
13 # This software is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 #
17 #=============================================================================
18  
19 5 ▶use 5.014_001;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 5 package Term::CLI::L10N 0.051003 {
22  
23 5 ▶use Modern::Perl 1.20140107;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 5 ▶use parent 0.228 qw( Locale::Maketext Exporter );
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 BEGIN {
28 5 ▶ our @EXPORT_OK = qw( __ loc );
Subroutine BEGIN: called CC=1 SCAR=0.0
29 5 our @EXPORT = qw( loc );
30 5 our %EXPORT_TAGS = (
31 'all' => \@EXPORT_OK
32 );
33 }
34  
35 5 our $lh;
36  
37 sub _init_handle {
38 150 ▶ $lh //= __PACKAGE__->get_handle() || __PACKAGE__->get_handle('en')
Subroutine _init_handle: called CC=4 SCAR=20.1
Branch: 1 branch
BranchTrueFalseTotal
$Term::CLI::L10N::lh //= __PACKAGE__->get_handle || __PACKAGE__->get_handle("en") or die "No language files for 'en'" 0 150 150
Condition16%1/6
$Term::CLI::L10N::lh //= __PACKAGE__->get_handle || __PACKAGE__->get_handle("en")
l!l&&r!l&&!r
15000
__PACKAGE__->get_handle || __PACKAGE__->get_handle('en')
l!l&&r!l&&!r
000
MC/DC0%0/3
$Term::CLI::L10N::lh //= __PACKAGE__->get_handle || __PACKAGE__->get_handle("en")
$Term::CLI::L10N::lh __PACKAGE__->get_handle __PACKAGE__->get_handle('en')
Truth table0%0/4
A //= B || C
A= $Term::CLI::L10N::lhB= __PACKAGE__->get_handleC= __PACKAGE__->get_handle('en')
ABCresult
1XX1
01X1
0011
0000
39 or die "No language files for 'en'";
40 150 return $lh;
41 }
42  
43 5 *__ = \&loc; # Alias __ to loc().
44  
45 sub handle {
46 150 ▶ return _init_handle();
Subroutine handle: called CC=1 SCAR=0.0
Pod documented
47 }
48  
49 sub loc {
50 0 ▶ _init_handle();
Subroutine loc: not called CC=1 SCAR=6.9
Pod documented
51 0 return $lh->SUPER::maketext(@_);
52 }
53  
54 sub set_language {
55 1 ▶ my $self = shift;
Subroutine set_language: called CC=2 SCAR=7.1
Pod documented
56  
57 1 ▶ $lh = __PACKAGE__->get_handle(@_)
Branch: 1 branch
BranchTrueFalseTotal
$Term::CLI::L10N::lh = __PACKAGE__->get_handle(@_) or die "No language files for (@_)" 0 1 1
58 or die "No language files for (@_)";
59 1 return $lh;
60 }
61  
62 }
63  
64 5 1;
65  
66 __END__
« CLI/Role/CommandSet.pm ↑ Summary CLI/Argument/Number/Int.pm »