line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::PO::Parser; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
90596
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
5
|
2
|
|
|
2
|
|
9
|
use Carp; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
191
|
|
6
|
2
|
|
|
2
|
|
2588
|
use Class::Std::Utils; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use IO::File; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use version; our $VERSION = qv('0.0.1'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $pofile; |
14
|
|
|
|
|
|
|
my $open_file; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $msgid; |
17
|
|
|
|
|
|
|
my $comment; |
18
|
|
|
|
|
|
|
my $msgstr; |
19
|
|
|
|
|
|
|
my $line; |
20
|
|
|
|
|
|
|
my $msgid_line; |
21
|
|
|
|
|
|
|
my $current; |
22
|
|
|
|
|
|
|
my $buf_comment; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new |
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
my ($class,$ref_arg) = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $obj = bless anon_scalar(), $class; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$pofile = $ref_arg; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$open_file = new IO::File ($pofile) or croak "can't open $_ : $!"; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$line = 0; |
36
|
|
|
|
|
|
|
$msgid_line =0; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return $obj; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub DESTROY |
42
|
|
|
|
|
|
|
{ |
43
|
|
|
|
|
|
|
$open_file->close; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub end_file |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
return eof($open_file); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub next |
52
|
|
|
|
|
|
|
{ |
53
|
|
|
|
|
|
|
my $continue = 1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$msgid=""; |
56
|
|
|
|
|
|
|
$msgstr=""; |
57
|
|
|
|
|
|
|
$comment=$buf_comment; |
58
|
|
|
|
|
|
|
my $current = ""; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
while ((<$open_file> ))#and $continue)) |
62
|
|
|
|
|
|
|
{ |
63
|
|
|
|
|
|
|
$line++; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
if(/^#/ and ($msgid eq "")) |
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
$comment = $comment . $_; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
elsif (/^#/ and not ($msgid eq "")) |
70
|
|
|
|
|
|
|
{ |
71
|
|
|
|
|
|
|
$buf_comment = $_; |
72
|
|
|
|
|
|
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
elsif (/^msgid/) |
75
|
|
|
|
|
|
|
{ |
76
|
|
|
|
|
|
|
$_ =~ s/^msgid//; |
77
|
|
|
|
|
|
|
$_ =~ s/^ \"//; |
78
|
|
|
|
|
|
|
$_ =~ s/\"$//; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$msgid = $msgid . $_; |
81
|
|
|
|
|
|
|
$msgid_line = $line; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$current = "msgid"; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
elsif (/^msgstr/) |
86
|
|
|
|
|
|
|
{ |
87
|
|
|
|
|
|
|
$_ =~ s/^msgstr//; |
88
|
|
|
|
|
|
|
$_ =~ s/^ \"//; |
89
|
|
|
|
|
|
|
$_ =~ s/\"$//; |
90
|
|
|
|
|
|
|
$msgstr = $msgstr . $_; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$current = "msgstr"; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
else |
95
|
|
|
|
|
|
|
{ |
96
|
|
|
|
|
|
|
unless (/^$/) |
97
|
|
|
|
|
|
|
{ |
98
|
|
|
|
|
|
|
$_ =~ s/^ \"//; |
99
|
|
|
|
|
|
|
$_ =~ s/\"$//; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
if ($current eq "msgid") |
102
|
|
|
|
|
|
|
{ |
103
|
|
|
|
|
|
|
$msgid = $msgid . $_; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
elsif ($current eq "msgstr") |
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
$msgstr = $msgstr . $_; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
else |
110
|
|
|
|
|
|
|
{ |
111
|
|
|
|
|
|
|
carp "there is probably a bug in the module code here at line $line of file $pofile"; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
return; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub get_comment |
121
|
|
|
|
|
|
|
{ |
122
|
|
|
|
|
|
|
return $comment; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub get_msgid |
126
|
|
|
|
|
|
|
{ |
127
|
|
|
|
|
|
|
return $msgid; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub get_msgid_line |
131
|
|
|
|
|
|
|
{ |
132
|
|
|
|
|
|
|
return $msgid_line; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub get_msgstr |
136
|
|
|
|
|
|
|
{ |
137
|
|
|
|
|
|
|
return $msgstr; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
141
|
|
|
|
|
|
|
__END__ |