line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Petal::TranslationService::MOFile; |
2
|
1
|
|
|
1
|
|
19009
|
use Locale::Maketext::Gettext; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
3
|
1
|
|
|
1
|
|
6
|
use Encode; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
84
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
327
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
4
|
|
|
4
|
0
|
2867
|
my $class = shift; |
11
|
4
|
|
33
|
|
|
15
|
my $file = shift || do { |
12
|
|
|
|
|
|
|
warn "No file specified for " . __PACKAGE__ . "::new (\$file)"; |
13
|
|
|
|
|
|
|
return bless {}, $class; |
14
|
|
|
|
|
|
|
}; |
15
|
|
|
|
|
|
|
|
16
|
4
|
50
|
|
|
|
65
|
-e $file or do { |
17
|
0
|
|
|
|
|
0
|
warn "$file does not seem to exist"; |
18
|
0
|
|
|
|
|
0
|
return bless {}, $class; |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
4
|
50
|
|
|
|
52
|
-f $file or do { |
22
|
0
|
|
|
|
|
0
|
warn "$file does not seem to be a file"; |
23
|
0
|
|
|
|
|
0
|
return bless {}, $class; |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
18
|
my $self = bless { file => $file }, $class; |
27
|
4
|
|
|
|
|
19
|
$self->{lexicon} = { read_mo ($file) }; |
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
|
|
811
|
($self->{encoding}) = $self->{lexicon}{""} =~ /^Content-Type: text\/plain; charset=(.*)$/im; |
30
|
4
|
|
|
|
|
12
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub maketext |
35
|
|
|
|
|
|
|
{ |
36
|
10
|
|
|
10
|
0
|
370
|
my $self = shift; |
37
|
10
|
|
50
|
|
|
21
|
my $id = shift || return; |
38
|
10
|
50
|
|
|
|
22
|
$self->{lexicon} || return; |
39
|
10
|
|
|
|
|
17
|
my $res = $self->{lexicon}->{$id}; |
40
|
|
|
|
|
|
|
|
41
|
10
|
100
|
|
|
|
35
|
return undef unless defined $res; |
42
|
|
|
|
|
|
|
|
43
|
8
|
|
|
|
|
31
|
return decode($self->{encoding}, $res); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |