line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::TextDomain::IfEnv; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2019-12-26'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'Locale-TextDomain-IfEnv'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#use strict 'subs', 'vars'; |
9
|
|
|
|
|
|
|
#use warnings; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
12
|
1
|
|
|
1
|
|
9
|
my $class = shift; |
13
|
1
|
|
|
|
|
2
|
local $Locale::TextDomain::IfEnv::textdomain = shift; |
14
|
1
|
|
|
|
|
3
|
local @Locale::TextDomain::IfEnv::search_dirs = @_; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
2
|
my $caller = caller; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
5
|
if ($ENV{PERL_LOCALE_TEXTDOMAIN_IFENV}) { |
19
|
0
|
|
|
|
|
0
|
require Locale::TextDomain; |
20
|
0
|
|
|
|
|
0
|
eval "package $caller; use Locale::TextDomain \$Locale::TextDomain::IfEnv::textdomain, \@Locale::TextDomain::IfEnv::search_dirs;"; |
21
|
0
|
0
|
|
|
|
0
|
die if $@; |
22
|
|
|
|
|
|
|
} else { |
23
|
1
|
|
|
|
|
910
|
require Locale::TextDomain::Mock; |
24
|
1
|
|
|
1
|
|
8
|
eval "package $caller; use Locale::TextDomain::Mock;"; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
81
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
# ABSTRACT: Enable translation only when environment variable flag is true |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |