line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::MobileJPPictogram; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
107256
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
78
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
56
|
|
5
|
2
|
|
|
2
|
|
42
|
use 5.0080008; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
109
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Template::Plugin; |
9
|
2
|
|
|
2
|
|
9
|
use base qw(Template::Plugin); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1551
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
12228
|
use Encode::JP::Mobile ':props'; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Encode::JP::Mobile::Charnames; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
|
|
|
|
|
|
my ( $self, $context, @args ) = @_; |
16
|
|
|
|
|
|
|
$context->define_filter( 'pictogram_charname', \&_charname, 1 ); |
17
|
|
|
|
|
|
|
$context->define_filter( 'pictogram_unicode', \&_unicode, 1 ); |
18
|
|
|
|
|
|
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _charname { |
22
|
|
|
|
|
|
|
my ( $ctx, $unicode ) = @_; |
23
|
|
|
|
|
|
|
die "unicode string missing for pictogram_charname" unless $unicode; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub { |
26
|
|
|
|
|
|
|
local $_ = shift; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
s{(\p{InMobileJPPictograms})}{ |
29
|
|
|
|
|
|
|
my $name = Encode::JP::Mobile::Charnames::unicode2name(unpack 'U*', $1); |
30
|
|
|
|
|
|
|
sprintf $unicode, $name; |
31
|
|
|
|
|
|
|
}ge; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$_; |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _unicode { |
38
|
|
|
|
|
|
|
my ( $ctx, $unicode ) = @_; |
39
|
|
|
|
|
|
|
die "unicode string missing for pictogram_unicode" unless $unicode; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub { |
42
|
|
|
|
|
|
|
local $_ = shift; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
s{(\p{InMobileJPPictograms})}{ |
45
|
|
|
|
|
|
|
sprintf $unicode, unpack 'U*', $1; |
46
|
|
|
|
|
|
|
}ge; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$_; |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
__END__ |