| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Locale::TextDomain::Mock; |
|
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 __expand($@) { |
|
12
|
8
|
|
|
8
|
|
19
|
my ($translation, %args) = @_; |
|
13
|
8
|
|
|
|
|
20
|
my $re = join '|', map { quotemeta $_ } keys %args; |
|
|
8
|
|
|
|
|
32
|
|
|
14
|
8
|
50
|
|
|
|
78
|
$translation =~ s/\{($re)\}/defined $args{$1} ? $args{$1} : "{$1}"/ge; |
|
|
8
|
|
|
|
|
45
|
|
|
15
|
8
|
|
|
|
|
47
|
$translation; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# plain string |
|
19
|
|
|
|
|
|
|
sub __($) { |
|
20
|
1
|
|
|
1
|
|
111
|
$_[0]; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# interpolation |
|
24
|
|
|
|
|
|
|
sub __x($@) { |
|
25
|
2
|
|
|
2
|
|
9
|
goto &__expand; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# plural |
|
29
|
|
|
|
|
|
|
sub __n($$$) { |
|
30
|
4
|
|
|
4
|
|
19
|
my ($msgid, $msgid_plural, $count) = @_; |
|
31
|
4
|
100
|
|
|
|
28
|
$count > 1 ? $msgid_plural : $msgid; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# plural + interpolation |
|
35
|
|
|
|
|
|
|
sub __nx($$$@) { |
|
36
|
6
|
|
|
6
|
|
19
|
my ($msgid, $msgid_plural, $count, %args) = @_; |
|
37
|
6
|
100
|
|
|
|
28
|
__expand($count > 1 ? $msgid_plural : $msgid, %args); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# alias for __nx |
|
41
|
|
|
|
|
|
|
sub __xn($$$@) { |
|
42
|
2
|
|
|
2
|
|
6
|
goto &__nx; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# context |
|
46
|
|
|
|
|
|
|
sub __p($$) { |
|
47
|
1
|
|
|
1
|
|
5
|
$_[1]; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# context + interpolation |
|
51
|
|
|
|
|
|
|
sub __px($$@) { |
|
52
|
1
|
|
|
1
|
|
3
|
my $context = shift; |
|
53
|
1
|
|
|
|
|
4
|
goto &__x; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# context + plural |
|
57
|
|
|
|
|
|
|
sub __np($$$$) { |
|
58
|
2
|
|
|
2
|
|
5
|
my $context = shift; |
|
59
|
2
|
|
|
|
|
7
|
goto &__n; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# context + plural + interpolation |
|
63
|
|
|
|
|
|
|
sub __npx($$$$@) { |
|
64
|
2
|
|
|
2
|
|
5
|
my $context = shift; |
|
65
|
2
|
|
|
|
|
8
|
goto &__nx; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Dummy functions for string marking. |
|
69
|
|
|
|
|
|
|
sub N__($) { |
|
70
|
1
|
|
|
1
|
0
|
6
|
return shift; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub N__n($$$) { |
|
74
|
1
|
|
|
1
|
0
|
6
|
return @_; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub N__p($$) { |
|
78
|
1
|
|
|
1
|
0
|
6
|
return @_; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub N__np($$$$) { |
|
82
|
1
|
|
|
1
|
0
|
8
|
return @_; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub import { |
|
86
|
1
|
|
|
1
|
|
2
|
my $class = shift; |
|
87
|
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
2
|
my $caller = caller; |
|
89
|
1
|
|
|
|
|
3
|
for (qw(__ __x __n __nx __xn __p __px __np __npx |
|
90
|
|
|
|
|
|
|
N__ N__n N__p N__np)) { |
|
91
|
13
|
|
|
|
|
20
|
*{"$caller\::$_"} = \&{$_}; |
|
|
13
|
|
|
|
|
1620
|
|
|
|
13
|
|
|
|
|
21
|
|
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
|
96
|
|
|
|
|
|
|
# ABSTRACT: Mock Locale::TextDomain functions |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |