line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kwiki::Template::TT2::UTF8::Provider; |
2
|
1
|
|
|
1
|
|
2622
|
use base qw(Template::Provider); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1892
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub utf8_upgrade { |
6
|
0
|
|
|
0
|
0
|
|
my @list = map pack('U*', unpack 'U0U*', $_), @_; |
7
|
0
|
0
|
|
|
|
|
return wantarray ? @list : $list[0]; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _load { |
11
|
0
|
|
|
0
|
|
|
my $self = shift; |
12
|
0
|
|
|
|
|
|
my ($data, $error) = $self->SUPER::_load(@_); |
13
|
0
|
0
|
|
|
|
|
if(defined $data) { |
14
|
0
|
|
|
|
|
|
$data->{text} = utf8_upgrade($data->{text}); |
15
|
|
|
|
|
|
|
} |
16
|
0
|
|
|
|
|
|
return ($data, $error); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__DATA__ |