File Coverage

blib/lib/Encode/MIME/Name.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 12 14 85.7


line stmt bran cond sub pod time code
1             package Encode::MIME::Name;
2 35     35   217 use strict;
  35         67  
  35         1061  
3 35     35   234 use warnings;
  35         62  
  35         10930  
4             our $VERSION = do { my @r = ( q$Revision: 1.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
5              
6             # NOTE: This table must be 1:1 mapping
7             our %MIME_NAME_OF = (
8             'AdobeStandardEncoding' => 'Adobe-Standard-Encoding',
9             'AdobeSymbol' => 'Adobe-Symbol-Encoding',
10             'ascii' => 'US-ASCII',
11             'big5-hkscs' => 'Big5-HKSCS',
12             'cp1026' => 'IBM1026',
13             'cp1047' => 'IBM1047',
14             'cp1250' => 'windows-1250',
15             'cp1251' => 'windows-1251',
16             'cp1252' => 'windows-1252',
17             'cp1253' => 'windows-1253',
18             'cp1254' => 'windows-1254',
19             'cp1255' => 'windows-1255',
20             'cp1256' => 'windows-1256',
21             'cp1257' => 'windows-1257',
22             'cp1258' => 'windows-1258',
23             'cp37' => 'IBM037',
24             'cp424' => 'IBM424',
25             'cp437' => 'IBM437',
26             'cp500' => 'IBM500',
27             'cp775' => 'IBM775',
28             'cp850' => 'IBM850',
29             'cp852' => 'IBM852',
30             'cp855' => 'IBM855',
31             'cp857' => 'IBM857',
32             'cp860' => 'IBM860',
33             'cp861' => 'IBM861',
34             'cp862' => 'IBM862',
35             'cp863' => 'IBM863',
36             'cp864' => 'IBM864',
37             'cp865' => 'IBM865',
38             'cp866' => 'IBM866',
39             'cp869' => 'IBM869',
40             'cp936' => 'GBK',
41             'euc-cn' => 'EUC-CN',
42             'euc-jp' => 'EUC-JP',
43             'euc-kr' => 'EUC-KR',
44             #'gb2312-raw' => 'GB2312', # no, you're wrong, I18N::Charset
45             'hp-roman8' => 'hp-roman8',
46             'hz' => 'HZ-GB-2312',
47             'iso-2022-jp' => 'ISO-2022-JP',
48             'iso-2022-jp-1' => 'ISO-2022-JP-1',
49             'iso-2022-kr' => 'ISO-2022-KR',
50             'iso-8859-1' => 'ISO-8859-1',
51             'iso-8859-10' => 'ISO-8859-10',
52             'iso-8859-13' => 'ISO-8859-13',
53             'iso-8859-14' => 'ISO-8859-14',
54             'iso-8859-15' => 'ISO-8859-15',
55             'iso-8859-16' => 'ISO-8859-16',
56             'iso-8859-2' => 'ISO-8859-2',
57             'iso-8859-3' => 'ISO-8859-3',
58             'iso-8859-4' => 'ISO-8859-4',
59             'iso-8859-5' => 'ISO-8859-5',
60             'iso-8859-6' => 'ISO-8859-6',
61             'iso-8859-7' => 'ISO-8859-7',
62             'iso-8859-8' => 'ISO-8859-8',
63             'iso-8859-9' => 'ISO-8859-9',
64             #'jis0201-raw' => 'JIS_X0201',
65             #'jis0208-raw' => 'JIS_C6226-1983',
66             #'jis0212-raw' => 'JIS_X0212-1990',
67             'koi8-r' => 'KOI8-R',
68             'koi8-u' => 'KOI8-U',
69             #'ksc5601-raw' => 'KS_C_5601-1987',
70             'shiftjis' => 'Shift_JIS',
71             'UTF-16' => 'UTF-16',
72             'UTF-16BE' => 'UTF-16BE',
73             'UTF-16LE' => 'UTF-16LE',
74             'UTF-32' => 'UTF-32',
75             'UTF-32BE' => 'UTF-32BE',
76             'UTF-32LE' => 'UTF-32LE',
77             'UTF-7' => 'UTF-7',
78             'utf-8-strict' => 'UTF-8',
79             'viscii' => 'VISCII',
80             );
81              
82             # NOTE: %MIME_NAME_OF is still 1:1 mapping
83             our %ENCODE_NAME_OF = map { uc $MIME_NAME_OF{$_} => $_ } keys %MIME_NAME_OF;
84              
85             # Add additional 1:N mapping
86             $MIME_NAME_OF{'utf8'} = 'UTF-8';
87              
88 135     135 0 1481 sub get_mime_name($) { $MIME_NAME_OF{$_[0]} };
89              
90 50354     50354 0 113224 sub get_encode_name($) { $ENCODE_NAME_OF{uc $_[0]} };
91              
92             1;
93             __END__