line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::MetaSyntactic::Locale; |
2
|
9
|
|
|
9
|
|
34035
|
use strict; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
258
|
|
3
|
9
|
|
|
9
|
|
38
|
use warnings; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
285
|
|
4
|
9
|
|
|
9
|
|
704
|
use Acme::MetaSyntactic (); # do not export metaname and friends |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
181
|
|
5
|
9
|
|
|
9
|
|
3727
|
use Acme::MetaSyntactic::MultiList; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
296
|
|
6
|
9
|
|
|
9
|
|
44
|
use List::Util qw( shuffle ); |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
524
|
|
7
|
9
|
|
|
9
|
|
42
|
use Carp; |
|
9
|
|
|
|
|
38
|
|
|
9
|
|
|
|
|
776
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw( Acme::MetaSyntactic::MultiList ); |
10
|
|
|
|
|
|
|
our $VERSION = '1.000'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub init { |
13
|
|
|
|
|
|
|
# alias the older package variable %Locale to %MultiList |
14
|
9
|
|
|
9
|
|
48
|
no strict 'refs'; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
969
|
|
15
|
8
|
|
|
8
|
1
|
393
|
*{"$_[0]::Locale"} = \%{"$_[0]::MultiList"}; |
|
8
|
|
|
|
|
41
|
|
|
8
|
|
|
|
|
76
|
|
16
|
8
|
|
|
|
|
15
|
${"$_[0]::Separator"} = '_'; |
|
8
|
|
|
|
|
42
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# call the parent class init code |
19
|
8
|
|
|
|
|
38
|
goto &Acme::MetaSyntactic::MultiList::init; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
55
|
|
|
55
|
1
|
933515
|
my $class = shift; |
24
|
|
|
|
|
|
|
|
25
|
9
|
|
|
9
|
|
39
|
no strict 'refs'; |
|
9
|
|
|
|
|
10
|
|
|
9
|
|
|
|
|
2840
|
|
26
|
55
|
|
|
|
|
193
|
my $self = bless { @_, cache => [] }, $class; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# compute some defaults |
29
|
55
|
100
|
|
|
|
246
|
if( ! exists $self->{category} ) { |
30
|
|
|
|
|
|
|
$self->{category} = |
31
|
|
|
|
|
|
|
exists $self->{lang} |
32
|
|
|
|
|
|
|
? $self->{lang} |
33
|
53
|
100
|
100
|
|
|
303
|
: $ENV{LANGUAGE} || $ENV{LANG} || ''; |
34
|
53
|
100
|
100
|
|
|
230
|
if( !$self->{category} && $^O eq 'MSWin32' ) { |
35
|
2
|
|
|
|
|
5
|
eval { require Win32::Locale; }; |
|
2
|
|
|
|
|
14
|
|
36
|
2
|
50
|
|
|
|
11
|
$self->{category} = Win32::Locale::get_language() unless $@; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
55
|
|
|
|
|
79
|
my $cat = $self->{category}; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# support for territories |
43
|
55
|
100
|
100
|
|
|
204
|
if ( $cat && $cat ne ':all' ) { |
44
|
30
|
|
|
|
|
110
|
($cat) = $cat =~ /^([-A-Za-z_]+)/; |
45
|
30
|
|
50
|
|
|
80
|
$cat = lc( $cat || '' ); |
46
|
|
|
|
|
|
|
1 while $cat |
47
|
30
|
|
100
|
|
|
101
|
&& !exists ${"$class\::MultiList"}{$cat} |
|
33
|
|
66
|
|
|
187
|
|
48
|
|
|
|
|
|
|
&& $cat =~ s/_?[^_]*$//; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# fall back to last resort |
52
|
55
|
|
66
|
|
|
111
|
$self->{category} = $cat || ${"$class\::Default"}; |
53
|
55
|
|
|
|
|
192
|
$self->_compute_base(); |
54
|
55
|
|
|
|
|
149
|
return $self; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
*lang = \&Acme::MetaSyntactic::MultiList::category; |
58
|
|
|
|
|
|
|
*languages = \&Acme::MetaSyntactic::MultiList::categories; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |