File Coverage

blib/lib/Encode/JP/Mobile/Fallback.pm
Criterion Covered Total %
statement 23 23 100.0
branch 8 8 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 37 38 97.3


line stmt bran cond sub pod time code
1             package Encode::JP::Mobile::Fallback;
2 24     24   224 use strict;
  24         57  
  24         1055  
3 24     24   147 use warnings;
  24         73  
  24         829  
4 24     24   172 use Encode;
  24         49  
  24         2899  
5 24     24   154 use Encode::JP::Mobile ':props';
  24         60  
  24         8553  
6              
7             sub Encode::JP::Mobile::FB_CHARACTER {
8 761 100   761 0 1455572 my $check = @_ ? shift : Encode::FB_DEFAULT;
9              
10             return sub {
11 767     767   16552 my $code = shift;
12 767         1870 my $char = chr $code;
13 767         995 my $fallback_name;
14 767 100       4474 if ($char =~ /^\p{InMobileJPPictograms}$/) {
15 762         4245 my $obj = Encode::JP::Mobile::Character->from_unicode($code);
16 762         1616 for (qw( I V E )) {
17 2286         6696 my $f = $obj->fallback_name($_);
18 2286 100       38222 $fallback_name = $f if defined $f;
19             }
20             }
21 767 100       3240 return defined $fallback_name
22             ? encode('utf-8', $fallback_name)
23             : encode('x-utf8-docomo', $char, $check);
24             # using x-utf8-docomo for "utf8 but that has cp932 chars only"
25 761         5912 };
26             }
27              
28             1;
29             __END__