line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::Scope; |
2
|
2
|
|
|
2
|
|
59967
|
use 5.008005; |
|
2
|
|
|
|
|
13
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
29
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
733
|
use parent qw/Exporter/; |
|
2
|
|
|
|
|
465
|
|
|
2
|
|
|
|
|
9
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw/locale_scope/; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
496
|
use POSIX qw/setlocale/; |
|
2
|
|
|
|
|
5059
|
|
|
2
|
|
|
|
|
8
|
|
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
1
|
|
sub locale_scope { unshift @_, __PACKAGE__; goto \&new } |
|
0
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
0
|
|
|
0
|
0
|
|
my ($class, $category, $locale) = @_; |
17
|
0
|
|
0
|
|
|
|
return bless +{ |
18
|
|
|
|
|
|
|
category => $category, |
19
|
|
|
|
|
|
|
before => setlocale($category), |
20
|
|
|
|
|
|
|
current => setlocale($category, $locale) || die "failed to setlocale. locale: $locale", |
21
|
|
|
|
|
|
|
} => $class; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub DESTROY { |
25
|
0
|
|
|
0
|
|
|
my $self = shift; |
26
|
0
|
|
|
|
|
|
setlocale($self->{category}, $self->{before}); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
__END__ |