line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Provider::Encode; |
2
|
2
|
|
|
2
|
|
125217
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
94
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
11
|
use base qw(Template::Provider); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
103150
|
|
6
|
2
|
|
|
2
|
|
260169
|
use Encode; |
|
2
|
|
|
|
|
34899
|
|
|
2
|
|
|
|
|
821
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
9
|
|
|
|
|
|
|
our $INPUT_ENCODING; |
10
|
|
|
|
|
|
|
our $OUTPUT_ENCODING; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
1
|
|
|
1
|
1
|
17
|
my $class = shift; |
14
|
1
|
|
|
|
|
2
|
my $options = shift; |
15
|
|
|
|
|
|
|
|
16
|
1
|
50
|
|
|
|
6
|
$INPUT_ENCODING = exists $options->{ie} ? $options->{ie} : undef; |
17
|
1
|
50
|
|
|
|
4
|
$OUTPUT_ENCODING = exists $options->{oe} ? $options->{oe} : undef; |
18
|
1
|
|
|
|
|
3
|
delete $options->{ie}; |
19
|
1
|
|
|
|
|
2
|
delete $options->{oe}; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
13
|
return $class->SUPER::new($options); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _load { |
25
|
1
|
|
|
1
|
|
43533
|
my $self = shift; |
26
|
1
|
|
|
|
|
14
|
my ($data, $error) = $self->SUPER::_load(@_); |
27
|
|
|
|
|
|
|
|
28
|
1
|
50
|
33
|
|
|
259
|
if ($INPUT_ENCODING and $OUTPUT_ENCODING) { |
29
|
1
|
|
|
|
|
7
|
Encode::from_to($data->{text}, $INPUT_ENCODING, $OUTPUT_ENCODING ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
23979
|
return ($data, $error); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |