File Coverage

blib/lib/Encode/JP/Mobile/UnicodeEmojiMBGA.pm
Criterion Covered Total %
statement 16 18 88.8
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 24 91.6


line stmt bran cond sub pod time code
1             package Encode::JP::Mobile::UnicodeEmojiMBGA;
2 1     1   28387 use strict;
  1         3  
  1         40  
3 1     1   5 use warnings;
  1         2  
  1         29  
4 1     1   6 use base qw(Encode::Encoding);
  1         2  
  1         125  
5 1     1   17 use Encode::Alias;
  1         2  
  1         54  
6 1     1   5 use Encode qw(:fallbacks);
  1         2  
  1         205  
7 1     1   2052 use Encode::JP::Mobile;
  0            
  0            
8             use Encode::JP::Emoji;
9             use Encode::JP::Emoji::Property;
10             use Encode::MIME::Name;
11             our $VERSION = '0.012';
12              
13             __PACKAGE__->Define(qw(x-utf8-jp-mobile-unicode-emoji-mbga));
14             $Encode::MIME::Name::MIME_NAME_OF{'x-utf8-jp-mobile-unicode-emoji-mbga'} = 'UTF-8';
15              
16             sub _encoding1() { Encode::find_encoding('x-utf8-e4u-unicode') }
17             sub _encoding2() { Encode::find_encoding('x-utf8-e4u-docomo') }
18             sub _encoding3() { Encode::find_encoding('x-utf8-docomo') }
19             sub _encoding4() { Encode::find_encoding('x-utf8-softbank') }
20              
21              
22             sub decode($$;$) {
23             my ($self, $str, $chk) = @_;
24              
25             $str = Encode::decode($self->_encoding1 => $str, $chk);
26             if ($str =~ /\p{InEmojiGoogle}/) {
27             $str = Encode::encode($self->_encoding2 => $str, $chk);
28             $str = Encode::decode($self->_encoding3 => $str, $chk);
29             }
30             $str;
31             }
32              
33             sub encode($$;$) {
34             my ( $self, $str, $chk ) = @_;
35              
36             Encode::encode($self->_encoding4 => $str, $chk);
37             }
38              
39             1;
40             __END__