From: Jarkko Hietaniemi Date: Sat, 9 Mar 2002 23:56:42 +0000 (+0000) Subject: Better fix from Autrijus. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b217bf73d430ffced5df002acc8d61b94778d76;p=p5sagit%2Fp5-mst-13.2.git Better fix from Autrijus. p4raw-id: //depot/perl@15136 --- diff --git a/ext/Encode/CN/CN.pm b/ext/Encode/CN/CN.pm index b2d1795..185c0cf 100644 --- a/ext/Encode/CN/CN.pm +++ b/ext/Encode/CN/CN.pm @@ -6,9 +6,6 @@ use Encode::CN::HZ; use XSLoader; XSLoader::load('Encode::CN',$VERSION); -local $@; -eval "use Encode::HanExtra"; # load extra encodings if they exist - 1; __END__ =head1 NAME @@ -17,9 +14,9 @@ Encode::CN - China-based Chinese Encodings =head1 SYNOPSIS - use Encode::CN; - $euc_cn = encode("euc-cn", $utf8); - $utf8 = encode("euc-cn", $euc_cn); + use Encode 'encode'; + $euc_cn = encode("euc-cn", $utf8); # loads Encode::CN implicitly + $utf8 = encode("euc-cn", $euc_cn); # ditto =head1 DESCRIPTION @@ -41,9 +38,6 @@ Due to size concerns, C (an extension to C) is distributed separately on CPAN, under the name L. That module also contains extra Taiwan-based encodings. -This module will automatically load L if you have it on -your machine. - =head1 BUGS ASCII part (0x00-0x7f) is preserved for all encodings, even though it diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index 5d21184..2084354 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -57,37 +57,28 @@ our %winlatin2cp = ( 'Vietnamese' => 1258, ); -BEGIN { - our %external_tables = - ( - 'euc-cn' => 'Encode/CN.pm', - gb2312 => 'Encode/CN.pm', - gb12345 => 'Encode/CN.pm', - gbk => 'Encode/CN.pm', - cp936 => 'Encode/CN.pm', - 'iso-ir-165' => 'Encode/CN.pm', - 'euc-jp' => 'Encode/JP.pm', - shiftjis => 'Encode/JP.pm', - macjapan => 'Encode/JP.pm', - cp932 => 'Encode/JP.pm', - 'euc-kr' => 'Encode/KR.pm', - ksc5601 => 'Encode/KR.pm', - cp949 => 'Encode/KR.pm', - big5 => 'Encode/TW.pm', - 'big5-hkscs' => 'Encode/TW.pm', - cp950 => 'Encode/TW.pm', - ); - - eval 'require Encode::HanExtra'; - unless ($@) { - push %external_tables, - ( - gb18030 => 'Encode/CN.pm', # HanExtra - big5plus => 'Encode/TW.pm', # HanExtra - 'euc-tw', => 'Encode/TW.pm', # HanExtra - ); - } -} +our %external_tables = + ( + 'euc-cn' => 'Encode/CN.pm', + gb2312 => 'Encode/CN.pm', + gb12345 => 'Encode/CN.pm', + gbk => 'Encode/CN.pm', + cp936 => 'Encode/CN.pm', + 'iso-ir-165' => 'Encode/CN.pm', + 'euc-jp' => 'Encode/JP.pm', + shiftjis => 'Encode/JP.pm', + macjapan => 'Encode/JP.pm', + cp932 => 'Encode/JP.pm', + 'euc-kr' => 'Encode/KR.pm', + ksc5601 => 'Encode/KR.pm', + cp949 => 'Encode/KR.pm', + big5 => 'Encode/TW.pm', + 'big5-hkscs' => 'Encode/TW.pm', + cp950 => 'Encode/TW.pm', + gb18030 => 'Encode/HanExtra.pm', + big5plus => 'Encode/HanExtra.pm', + 'euc-tw' => 'Encode/HanExtra.pm', + ); sub encodings { diff --git a/ext/Encode/JP/JP.pm b/ext/Encode/JP/JP.pm index d36323e..aadf339 100644 --- a/ext/Encode/JP/JP.pm +++ b/ext/Encode/JP/JP.pm @@ -20,9 +20,9 @@ Encode::JP - Japanese Encodings =head1 SYNOPSIS - use Encode::JP; - $euc_jp = encode("euc-jp", $utf8); - $utf8 = encode("euc-jp", $euc_jp); + use Encode 'encode'; + $euc_jp = encode("euc-jp", $utf8); # loads Encode::JP implicitly + $utf8 = encode("euc-jp", $euc_jp); # ditto =head1 ABSTRACT diff --git a/ext/Encode/KR/KR.pm b/ext/Encode/KR/KR.pm index 9936c5d..fabe334 100644 --- a/ext/Encode/KR/KR.pm +++ b/ext/Encode/KR/KR.pm @@ -13,9 +13,9 @@ Encode::KR - Korean Encodings =head1 SYNOPSIS - use Encode::CN; - $euc_kr = encode("euc-kr", $utf8); - $utf8 = encode("euc-kr", $euc_kr); + use Encode 'encode'; + $euc_kr = encode("euc-kr", $utf8); # loads Encode::KR implicitly + $utf8 = encode("euc-kr", $euc_kr); # ditto =head1 DESCRIPTION diff --git a/ext/Encode/TW/TW.pm b/ext/Encode/TW/TW.pm index c3f64fd..20402c2 100644 --- a/ext/Encode/TW/TW.pm +++ b/ext/Encode/TW/TW.pm @@ -5,9 +5,6 @@ use Encode; use XSLoader; XSLoader::load('Encode::TW',$VERSION); -local $@; -eval "use Encode::HanExtra"; # load extra encodings if they exist - 1; __END__ =head1 NAME @@ -16,9 +13,9 @@ Encode::TW - Taiwan-based Chinese Encodings =head1 SYNOPSIS - use Encode::CN; - $big5 = encode("big5", $utf8); - $utf8 = encode("big5", $big5); + use Encode 'encode'; + $big5 = encode("big5", $utf8); # loads Encode::TW implicitly + $utf8 = encode("big5", $big5); # ditto =head1 DESCRIPTION @@ -37,9 +34,6 @@ Due to size concerns, C (Extended Unix Character) and C (CMEX's Big5+) are distributed separately on CPAN, under the name L. That module also contains extra China-based encodings. -This module will automatically load L if you have it on -your machine. - =head1 BUGS The C encoding files are not complete (only the first two planes,