| 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
Condition16%1/6
$Term::CLI::L10N::lh //= __PACKAGE__->get_handle || __PACKAGE__->get_handle("en")
__PACKAGE__->get_handle || __PACKAGE__->get_handle('en')
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')
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | or die "No language files for (@_)"; | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | return $lh; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | __END__ | ||||||||||||||||||||||||||||||||||||||||||