line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::MetaSyntactic::Locale; |
2
|
9
|
|
|
9
|
|
159575
|
use strict; |
|
9
|
|
|
|
|
43
|
|
|
9
|
|
|
|
|
301
|
|
3
|
9
|
|
|
9
|
|
55
|
use warnings; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
295
|
|
4
|
9
|
|
|
9
|
|
1044
|
use Acme::MetaSyntactic (); # do not export metaname and friends |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
185
|
|
5
|
9
|
|
|
9
|
|
4226
|
use Acme::MetaSyntactic::MultiList; |
|
9
|
|
|
|
|
27
|
|
|
9
|
|
|
|
|
298
|
|
6
|
9
|
|
|
9
|
|
62
|
use List::Util qw( shuffle ); |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
486
|
|
7
|
9
|
|
|
9
|
|
53
|
use Carp; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
702
|
|
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
|
|
67
|
no strict 'refs'; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
1125
|
|
15
|
8
|
|
|
8
|
1
|
1385
|
*{"$_[0]::Locale"} = \%{"$_[0]::MultiList"}; |
|
8
|
|
|
|
|
45
|
|
|
8
|
|
|
|
|
57
|
|
16
|
8
|
|
|
|
|
18
|
${"$_[0]::Separator"} = '_'; |
|
8
|
|
|
|
|
53
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# call the parent class init code |
19
|
8
|
|
|
|
|
39
|
goto &Acme::MetaSyntactic::MultiList::init; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
56
|
|
|
56
|
1
|
636052
|
my $class = shift; |
24
|
|
|
|
|
|
|
|
25
|
9
|
|
|
9
|
|
72
|
no strict 'refs'; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
3001
|
|
26
|
56
|
|
|
|
|
223
|
my $self = bless { @_, cache => [] }, $class; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# compute some defaults |
29
|
56
|
100
|
|
|
|
277
|
if( ! exists $self->{category} ) { |
30
|
|
|
|
|
|
|
$self->{category} = |
31
|
|
|
|
|
|
|
exists $self->{lang} |
32
|
|
|
|
|
|
|
? $self->{lang} |
33
|
54
|
100
|
100
|
|
|
357
|
: $ENV{LANGUAGE} || $ENV{LANG} || ''; |
34
|
54
|
100
|
100
|
|
|
265
|
if( !$self->{category} && $^O eq 'MSWin32' ) { |
35
|
2
|
|
|
|
|
6
|
eval { require Win32::Locale; }; |
|
2
|
|
|
|
|
13
|
|
36
|
2
|
50
|
|
|
|
13
|
$self->{category} = Win32::Locale::get_language() unless $@; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
56
|
|
|
|
|
117
|
my $cat = $self->{category}; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# support for territories |
43
|
56
|
100
|
100
|
|
|
226
|
if ( $cat && $cat ne ':all' ) { |
44
|
30
|
|
|
|
|
164
|
($cat) = $cat =~ /^([-A-Za-z_]+)/; |
45
|
30
|
|
50
|
|
|
102
|
$cat = lc( $cat || '' ); |
46
|
|
|
|
|
|
|
1 while $cat |
47
|
30
|
|
100
|
|
|
83
|
&& !exists ${"$class\::MultiList"}{$cat} |
|
33
|
|
66
|
|
|
234
|
|
48
|
|
|
|
|
|
|
&& $cat =~ s/_?[^_]*$//; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# fall back to last resort |
52
|
56
|
|
66
|
|
|
169
|
$self->{category} = $cat || ${"$class\::Default"}; |
53
|
56
|
|
|
|
|
274
|
$self->_compute_base(); |
54
|
56
|
|
|
|
|
189
|
return $self; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
*lang = \&Acme::MetaSyntactic::MultiList::category; |
58
|
|
|
|
|
|
|
*languages = \&Acme::MetaSyntactic::MultiList::categories; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |