From: Rafael Garcia-Suarez Date: Tue, 6 Jun 2006 12:37:34 +0000 (+0000) Subject: Upgrade to Encode 2.18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=656ebd29b326e7cb4e9181b77b10fccb1c1df3c6;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Encode 2.18 p4raw-id: //depot/perl@28359 --- diff --git a/ext/Encode/Byte/Byte.pm b/ext/Encode/Byte/Byte.pm index 03ba73a..0824368 100644 --- a/ext/Encode/Byte/Byte.pm +++ b/ext/Encode/Byte/Byte.pm @@ -1,6 +1,8 @@ package Encode::Byte; +use strict; +use warnings; use Encode; -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/ext/Encode/CN/CN.pm b/ext/Encode/CN/CN.pm index cdd3ae7..9f120fb 100644 --- a/ext/Encode/CN/CN.pm +++ b/ext/Encode/CN/CN.pm @@ -1,13 +1,13 @@ package Encode::CN; - BEGIN { if ( ord("A") == 193 ) { die "Encode::CN not supported on EBCDIC\n"; } } -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; - +use strict; +use warnings; use Encode; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/ext/Encode/Changes b/ext/Encode/Changes index cef5e12..e7b2d7a 100644 --- a/ext/Encode/Changes +++ b/ext/Encode/Changes @@ -1,8 +1,20 @@ # Revision history for Perl extension Encode. # -# $Id: Changes,v 2.16 2006/05/03 18:24:10 dankogai Exp $ +# $Id: Changes,v 2.17 2006/06/03 20:28:48 dankogai Exp dankogai $ # -$Revision: 2.16 $ $Date: 2006/05/03 18:24:10 $ +$Revision: 2.17 $ $Date: 2006/06/03 20:28:48 $ +! bin/enc2xs + overhauled the -C option + - added ascii-ctrl', 'null', 'utf-8-strict' to core + - auto-generated Encode::ConfigLocal no longer use v-string for version + - now searches modules via File::Find so Encode/JP/Mobile is happy +! Byte/Byte.pm CN/CN.pm EBCDIC/EBCDIC.pm JP/JP.pm KR/KR.pm Symbol/Symbol.pm + use strict added; though all they do is load XS, it's + still better a practice +! *.pm + use warnings added to all of them for better practices' sake. + +2.17 2006/05/09 17:10:09 ! encode.pm 'chin' =~ /^zh_CN|chin(?:a|ese)?$/i is true but chin is not china or chinese. diff --git a/ext/Encode/EBCDIC/EBCDIC.pm b/ext/Encode/EBCDIC/EBCDIC.pm index 0d63fe3..8024c13 100644 --- a/ext/Encode/EBCDIC/EBCDIC.pm +++ b/ext/Encode/EBCDIC/EBCDIC.pm @@ -1,6 +1,8 @@ package Encode::EBCDIC; +use strict; +use warnings; use Encode; -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index 439d0b1..7f07b9e 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -1,9 +1,10 @@ # -# $Id: Encode.pm,v 2.17 2006/05/09 17:10:42 dankogai Exp dankogai $ +# $Id: Encode.pm,v 2.18 2006/06/03 20:28:48 dankogai Exp dankogai $ # package Encode; use strict; -our $VERSION = sprintf "%d.%02d", q$Revision: 2.17 $ =~ /(\d+)/g; +use warnings; +our $VERSION = sprintf "%d.%02d", q$Revision: 2.18 $ =~ /(\d+)/g; sub DEBUG () { 0 } use XSLoader (); XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index 3a30f05..38e83dc 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -1,5 +1,5 @@ /* - $Id: Encode.xs,v 2.9 2006/05/03 18:24:10 dankogai Exp $ + $Id: Encode.xs,v 2.10 2006/06/03 20:28:48 dankogai Exp dankogai $ */ #define PERL_NO_GET_CONTEXT diff --git a/ext/Encode/JP/JP.pm b/ext/Encode/JP/JP.pm index 3577a8d..e78e54d 100644 --- a/ext/Encode/JP/JP.pm +++ b/ext/Encode/JP/JP.pm @@ -1,12 +1,13 @@ package Encode::JP; - BEGIN { if ( ord("A") == 193 ) { die "Encode::JP not supported on EBCDIC\n"; } } +use strict; +use warnings; use Encode; -our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/ext/Encode/KR/KR.pm b/ext/Encode/KR/KR.pm index 4a7ea72..8cb2c63 100644 --- a/ext/Encode/KR/KR.pm +++ b/ext/Encode/KR/KR.pm @@ -1,13 +1,13 @@ package Encode::KR; - BEGIN { if ( ord("A") == 193 ) { die "Encode::KR not supported on EBCDIC\n"; } } -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; - +use strict; +use warnings; use Encode; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/ext/Encode/Symbol/Symbol.pm b/ext/Encode/Symbol/Symbol.pm index e617bd4..77031aa 100644 --- a/ext/Encode/Symbol/Symbol.pm +++ b/ext/Encode/Symbol/Symbol.pm @@ -1,6 +1,8 @@ package Encode::Symbol; +use strict; +use warnings; use Encode; -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/ext/Encode/TW/TW.pm b/ext/Encode/TW/TW.pm index 236da36..ffaa844 100644 --- a/ext/Encode/TW/TW.pm +++ b/ext/Encode/TW/TW.pm @@ -1,13 +1,13 @@ package Encode::TW; - BEGIN { if ( ord("A") == 193 ) { die "Encode::TW not supported on EBCDIC\n"; } } -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; - +use strict; +use warnings; use Encode; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/ext/Encode/bin/enc2xs b/ext/Encode/bin/enc2xs index 6ca0efe..7c447be 100644 --- a/ext/Encode/bin/enc2xs +++ b/ext/Encode/bin/enc2xs @@ -9,7 +9,7 @@ use strict; use warnings; use Getopt::Std; my @orig_ARGV = @ARGV; -our $VERSION = do { my @r = (q$Revision: 2.3 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 2.4 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # These may get re-ordered. # RAW is a do_now as inserted by &enter @@ -961,54 +961,60 @@ use vars qw( $_LocalVer ); -sub make_configlocal_pm -{ +sub make_configlocal_pm { eval { require Encode; }; $@ and die "Unable to require Encode: $@\n"; eval { require File::Spec; }; + # our used for variable expanstion - my %in_core = map {$_=>1}('ascii','iso-8859-1','utf8'); + my %in_core = map { $_ => 1 } ( + 'ascii', 'iso-8859-1', 'utf8', + 'ascii-ctrl', 'null', 'utf-8-strict' + ); my %LocalMod = (); - for my $d (@INC){ - my $inc = File::Spec->catfile($d, "Encode"); - -d $inc or next; - opendir my $dh, $inc or die "$inc:$!"; - warn "Checking $inc...\n"; - for my $f (grep /\.pm$/o, readdir($dh)){ - -f File::Spec->catfile($inc, "$f") or next; - $INC{"Encode/$f"} and next; - warn "require Encode/$f;\n"; - eval { require "Encode/$f"; }; - $@ and die "Can't require Encode/$f: $@\n"; - for my $enc (Encode->encodings()){ - no warnings 'once'; - $in_core{$enc} and next; - $Encode::Config::ExtModule{$enc} and next; - my $mod = "Encode/$f"; - $mod =~ s/\.pm$//o; $mod =~ s,/,::,og; - $LocalMod{$enc} ||= $mod; - } - } - } + # check @enc; + use File::Find (); + my $wanted = sub{ + -f $_ or return; + $File::Find::name =~ /\A\./ and return; + $File::Find::name =~ /\.pm\z/ or return; + $File::Find::name =~ m/\bEncode\b/ or return; + my $mod = $File::Find::name; + $mod =~ s/.*\bEncode\b/Encode/o; + $mod =~ s/\.pm\z//o; + $mod =~ s,/,::,og; + warn qq{ require $mod;\n}; + eval qq{ require $mod; }; + $@ and die "Can't require $mod: $@\n"; + for my $enc ( Encode->encodings() ) { + no warnings; + $in_core{$enc} and next; + $Encode::Config::ExtModule{$enc} and next; + $LocalMod{$enc} ||= $mod; + } + }; + File::Find::find({wanted => $wanted}, @INC); $_ModLines = ""; - for my $enc (sort keys %LocalMod){ - $_ModLines .= - qq(\$Encode::ExtModule{'$enc'} =\t"$LocalMod{$enc}";\n); + for my $enc ( sort keys %LocalMod ) { + $_ModLines .= + qq(\$Encode::ExtModule{'$enc'} = "$LocalMod{$enc}";\n); } warn $_ModLines; $_LocalVer = _mkversion(); - $_E2X = find_e2x(); - $_Inc = $INC{"Encode.pm"}; $_Inc =~ s/\.pm$//o; - _print_expand(File::Spec->catfile($_E2X,"ConfigLocal_PM.e2x"), - File::Spec->catfile($_Inc,"ConfigLocal.pm"), - 1); + $_E2X = find_e2x(); + $_Inc = $INC{"Encode.pm"}; + $_Inc =~ s/\.pm$//o; + _print_expand( File::Spec->catfile( $_E2X, "ConfigLocal_PM.e2x" ), + File::Spec->catfile( $_Inc, "ConfigLocal.pm" ), 1 ); exit; } sub _mkversion{ - my ($ss,$mm,$hh,$dd,$mo,$yyyy) = localtime(); - $yyyy += 1900, $mo +=1; - return sprintf("v%04d.%04d.%04d", $yyyy, $mo*100+$dd, $hh*100+$mm); + # v-string is now depreciated; use time() instead; + #my ($ss,$mm,$hh,$dd,$mo,$yyyy) = localtime(); + #$yyyy += 1900, $mo +=1; + #return sprintf("v%04d.%04d.%04d", $yyyy, $mo*100+$dd, $hh*100+$mm); + return time(); } sub _print_expand{ diff --git a/ext/Encode/encoding.pm b/ext/Encode/encoding.pm index cca72fc..eb84e48 100644 --- a/ext/Encode/encoding.pm +++ b/ext/Encode/encoding.pm @@ -1,9 +1,10 @@ -# $Id: encoding.pm,v 2.3 2006/05/03 18:24:10 dankogai Exp $ +# $Id: encoding.pm,v 2.4 2006/06/03 20:28:48 dankogai Exp dankogai $ package encoding; -our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.4 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode; use strict; +use warnings; sub DEBUG () { 0 } diff --git a/ext/Encode/lib/Encode/Alias.pm b/ext/Encode/lib/Encode/Alias.pm index 2a4898b..858f60c 100644 --- a/ext/Encode/lib/Encode/Alias.pm +++ b/ext/Encode/lib/Encode/Alias.pm @@ -1,8 +1,9 @@ package Encode::Alias; use strict; +use warnings; no warnings 'redefine'; use Encode; -our $VERSION = do { my @r = ( q$Revision: 2.5 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.6 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; sub DEBUG () { 0 } use base qw(Exporter); diff --git a/ext/Encode/lib/Encode/CJKConstants.pm b/ext/Encode/lib/Encode/CJKConstants.pm index 411d3cd..ccc5231 100644 --- a/ext/Encode/lib/Encode/CJKConstants.pm +++ b/ext/Encode/lib/Encode/CJKConstants.pm @@ -1,13 +1,13 @@ # -# $Id: CJKConstants.pm,v 2.1 2006/05/03 18:24:10 dankogai Exp $ +# $Id: CJKConstants.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp dankogai $ # package Encode::CJKConstants; use strict; - -our $RCSID = q$Id: CJKConstants.pm,v 2.1 2006/05/03 18:24:10 dankogai Exp $; -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +use warnings; +our $RCSID = q$Id: CJKConstants.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp dankogai $; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Carp; diff --git a/ext/Encode/lib/Encode/CN/HZ.pm b/ext/Encode/lib/Encode/CN/HZ.pm index d178800..943dc23 100644 --- a/ext/Encode/lib/Encode/CN/HZ.pm +++ b/ext/Encode/lib/Encode/CN/HZ.pm @@ -1,9 +1,10 @@ package Encode::CN::HZ; use strict; +use warnings; use vars qw($VERSION); -$VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +$VERSION = do { my @r = ( q$Revision: 2.4 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode qw(:fallbacks); diff --git a/ext/Encode/lib/Encode/Config.pm b/ext/Encode/lib/Encode/Config.pm index 9c490ee..e6ca64d 100644 --- a/ext/Encode/lib/Encode/Config.pm +++ b/ext/Encode/lib/Encode/Config.pm @@ -2,9 +2,10 @@ # Demand-load module list # package Encode::Config; -our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use strict; +use warnings; our %ExtModule = ( diff --git a/ext/Encode/lib/Encode/Encoding.pm b/ext/Encode/lib/Encode/Encoding.pm index 47c9308..9ebf95b 100644 --- a/ext/Encode/lib/Encode/Encoding.pm +++ b/ext/Encode/lib/Encode/Encoding.pm @@ -2,7 +2,8 @@ package Encode::Encoding; # Base class for classes which implement encodings use strict; -our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +use warnings; +our $VERSION = do { my @r = ( q$Revision: 2.4 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; require Encode; diff --git a/ext/Encode/lib/Encode/Guess.pm b/ext/Encode/lib/Encode/Guess.pm index 260616e..1bc4df7 100644 --- a/ext/Encode/lib/Encode/Guess.pm +++ b/ext/Encode/lib/Encode/Guess.pm @@ -1,8 +1,8 @@ package Encode::Guess; use strict; - +use warnings; use Encode qw(:fallbacks find_encoding); -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; my $Canon = 'Guess'; sub DEBUG () { 0 } diff --git a/ext/Encode/lib/Encode/JP/H2Z.pm b/ext/Encode/lib/Encode/JP/H2Z.pm index 36a074a..81ce9ac 100644 --- a/ext/Encode/lib/Encode/JP/H2Z.pm +++ b/ext/Encode/lib/Encode/JP/H2Z.pm @@ -1,13 +1,14 @@ # -# $Id: H2Z.pm,v 2.1 2006/05/03 18:24:10 dankogai Exp $ +# $Id: H2Z.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp dankogai $ # package Encode::JP::H2Z; use strict; +use warnings; -our $RCSID = q$Id: H2Z.pm,v 2.1 2006/05/03 18:24:10 dankogai Exp $; -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $RCSID = q$Id: H2Z.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp dankogai $; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode::CJKConstants qw(:all); diff --git a/ext/Encode/lib/Encode/JP/JIS7.pm b/ext/Encode/lib/Encode/JP/JIS7.pm index 822461a..f2e0eca 100644 --- a/ext/Encode/lib/Encode/JP/JIS7.pm +++ b/ext/Encode/lib/Encode/JP/JIS7.pm @@ -1,7 +1,7 @@ package Encode::JP::JIS7; use strict; - -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +use warnings; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode qw(:fallbacks); diff --git a/ext/Encode/lib/Encode/KR/2022_KR.pm b/ext/Encode/lib/Encode/KR/2022_KR.pm index 7388093..0218d97 100644 --- a/ext/Encode/lib/Encode/KR/2022_KR.pm +++ b/ext/Encode/lib/Encode/KR/2022_KR.pm @@ -1,7 +1,7 @@ package Encode::KR::2022_KR; use strict; - -our $VERSION = do { my @r = ( q$Revision: 2.1 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +use warnings; +our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode qw(:fallbacks); diff --git a/ext/Encode/lib/Encode/MIME/Header.pm b/ext/Encode/lib/Encode/MIME/Header.pm index 6e4398e..7e8264a 100644 --- a/ext/Encode/lib/Encode/MIME/Header.pm +++ b/ext/Encode/lib/Encode/MIME/Header.pm @@ -1,8 +1,9 @@ package Encode::MIME::Header; use strict; +use warnings; +no warnings 'redefine'; -# use warnings; -our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.4 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode qw(find_encoding encode_utf8 decode_utf8); use MIME::Base64; use Carp; diff --git a/ext/Encode/lib/Encode/MIME/Header/ISO_2022_JP.pm b/ext/Encode/lib/Encode/MIME/Header/ISO_2022_JP.pm index 6d3ea46..4abfbd0 100644 --- a/ext/Encode/lib/Encode/MIME/Header/ISO_2022_JP.pm +++ b/ext/Encode/lib/Encode/MIME/Header/ISO_2022_JP.pm @@ -1,6 +1,8 @@ package Encode::MIME::Header::ISO_2022_JP; use strict; +use warnings; + use base qw(Encode::MIME::Header); $Encode::Encoding{'MIME-Header-ISO_2022_JP'} = @@ -12,7 +14,7 @@ use constant TAIL => '?='; use Encode::CJKConstants qw(%RE); -our $VERSION = do { my @r = ( q$Revision: 1.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 1.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; # I owe the below codes totally to # Jcode by Dan Kogai & http://www.din.or.jp/~ohzaki/perl.htm#JP_Base64 diff --git a/ext/Encode/lib/Encode/Unicode/UTF7.pm b/ext/Encode/lib/Encode/Unicode/UTF7.pm index cbbd492..f8cb169 100644 --- a/ext/Encode/lib/Encode/Unicode/UTF7.pm +++ b/ext/Encode/lib/Encode/Unicode/UTF7.pm @@ -1,12 +1,13 @@ # -# $Id: UTF7.pm,v 2.3 2006/05/03 18:24:10 dankogai Exp $ +# $Id: UTF7.pm,v 2.4 2006/06/03 20:28:48 dankogai Exp dankogai $ # package Encode::Unicode::UTF7; use strict; +use warnings; no warnings 'redefine'; use base qw(Encode::Encoding); __PACKAGE__->Define('UTF-7'); -our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.4 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use MIME::Base64; use Encode;