summaryrefslogtreecommitdiff
path: root/cpan/Encode
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2010-12-23 15:29:31 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2010-12-23 15:29:31 +0000
commit50afc8f8e1db17eaed554bcc3f6c964fa9a822d9 (patch)
treedf0a672fd28ee3661b6c87b39e3a6a4108442be3 /cpan/Encode
parent98df743aa286b8ac6160b72feb1c2fadf7320d98 (diff)
downloadperl-50afc8f8e1db17eaed554bcc3f6c964fa9a822d9.tar.gz
Update Encode to CPAN version 2.41
[DELTA] $Revision: 2.41 $ $Date: 2010/12/23 11:05:58 $ lib/Encode/MIME/Header.pm Applied: RT#63387 encode of MIME-Header inserts too much whitespace http://rt.cpan.org/Ticket/Display.html?id=63387 t/Aliases.t lib/Encode/Alias.pm Applied: RT#63286: Various Encode::Alias improvements http://rt.cpan.org/Ticket/Display.html?id=63286
Diffstat (limited to 'cpan/Encode')
-rw-r--r--cpan/Encode/Changes12
-rw-r--r--cpan/Encode/Encode.pm4
-rw-r--r--cpan/Encode/Encode.xs2
-rw-r--r--cpan/Encode/META.yml2
-rw-r--r--cpan/Encode/lib/Encode/Alias.pm19
-rw-r--r--cpan/Encode/lib/Encode/MIME/Header.pm4
-rw-r--r--cpan/Encode/lib/Encode/Unicode/UTF7.pm2
-rw-r--r--cpan/Encode/t/Aliases.t38
-rw-r--r--cpan/Encode/t/mime-header.t2
-rw-r--r--cpan/Encode/t/utf8ref.t2
-rw-r--r--cpan/Encode/ucm/nextstep.ucm2
11 files changed, 61 insertions, 28 deletions
diff --git a/cpan/Encode/Changes b/cpan/Encode/Changes
index 9eba2ed060..6434a3ad24 100644
--- a/cpan/Encode/Changes
+++ b/cpan/Encode/Changes
@@ -1,8 +1,16 @@
# Revision history for Perl extension Encode.
#
-# $Id: Changes,v 2.40 2010/09/18 18:39:51 dankogai Exp dankogai $
+# $Id: Changes,v 2.41 2010/12/23 11:05:58 dankogai Exp dankogai $
#
-$Revision: 2.40 $ $Date: 2010/09/18 18:39:51 $
+$Revision: 2.41 $ $Date: 2010/12/23 11:05:58 $
+lib/Encode/MIME/Header.pm
+ Applied: RT#63387 encode of MIME-Header inserts too much whitespace
+ http://rt.cpan.org/Ticket/Display.html?id=63387
+t/Aliases.t lib/Encode/Alias.pm
+ Applied: RT#63286: Various Encode::Alias improvements
+ http://rt.cpan.org/Ticket/Display.html?id=63286
+
+2.40 2010/09/18 18:39:51
! Encode.pm Encode.xs
+ t/utf8ref.t
Addressed: RT#59981: find_encoding("UTF-8")->encode crashes
diff --git a/cpan/Encode/Encode.pm b/cpan/Encode/Encode.pm
index 4e8cd3c7e5..b5850f8da7 100644
--- a/cpan/Encode/Encode.pm
+++ b/cpan/Encode/Encode.pm
@@ -1,10 +1,10 @@
#
-# $Id: Encode.pm,v 2.40 2010/09/18 18:39:51 dankogai Exp dankogai $
+# $Id: Encode.pm,v 2.41 2010/12/23 11:05:00 dankogai Exp $
#
package Encode;
use strict;
use warnings;
-our $VERSION = sprintf "%d.%02d", q$Revision: 2.40 $ =~ /(\d+)/g;
+our $VERSION = sprintf "%d.%02d", q$Revision: 2.41 $ =~ /(\d+)/g;
sub DEBUG () { 0 }
use XSLoader ();
XSLoader::load( __PACKAGE__, $VERSION );
diff --git a/cpan/Encode/Encode.xs b/cpan/Encode/Encode.xs
index d014d318e2..1a672d6999 100644
--- a/cpan/Encode/Encode.xs
+++ b/cpan/Encode/Encode.xs
@@ -1,5 +1,5 @@
/*
- $Id: Encode.xs,v 2.19 2010/09/18 18:39:51 dankogai Exp dankogai $
+ $Id: Encode.xs,v 2.19 2010/09/18 18:39:51 dankogai Exp $
*/
#define PERL_NO_GET_CONTEXT
diff --git a/cpan/Encode/META.yml b/cpan/Encode/META.yml
index b1757ab22a..a1b25e11a4 100644
--- a/cpan/Encode/META.yml
+++ b/cpan/Encode/META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Encode
-version: 2.40
+version: 2.41
abstract: ~
author: []
license: unknown
diff --git a/cpan/Encode/lib/Encode/Alias.pm b/cpan/Encode/lib/Encode/Alias.pm
index f142403ca9..f517a5a75a 100644
--- a/cpan/Encode/lib/Encode/Alias.pm
+++ b/cpan/Encode/lib/Encode/Alias.pm
@@ -2,7 +2,7 @@ package Encode::Alias;
use strict;
use warnings;
no warnings 'redefine';
-our $VERSION = do { my @r = ( q$Revision: 2.12 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
+our $VERSION = do { my @r = ( q$Revision: 2.13 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
sub DEBUG () { 0 }
use base qw(Exporter);
@@ -90,9 +90,9 @@ sub define_alias {
DEBUG and warn "delete \$Alias\{$k\}";
delete $Alias{$k};
}
- elsif ( ref($alias) eq 'CODE' ) {
+ elsif ( ref($alias) eq 'CODE' && $alias->($k) ) {
DEBUG and warn "delete \$Alias\{$k\}";
- delete $Alias{ $alias->($name) };
+ delete $Alias{$k};
}
}
}
@@ -286,7 +286,9 @@ Encode::Alias - alias definitions to encodings
use Encode;
use Encode::Alias;
- define_alias( newName => ENCODING);
+ define_alias( "newName" => ENCODING);
+ define_alias( qr/.../ => ENCODING);
+ define_alias( sub { return ENCODING if ...; } );
=head1 DESCRIPTION
@@ -294,7 +296,8 @@ Allows newName to be used as an alias for ENCODING. ENCODING may be
either the name of an encoding or an encoding object (as described
in L<Encode>).
-Currently I<newName> can be specified in the following ways:
+Currently the first argument to define_alias() can be specified in the
+following ways:
=over 4
@@ -321,7 +324,7 @@ experienced. Use this feature with caution.
The same effect as the example above in a different way. The coderef
takes the alias name as an argument and returns a canonical name on
-success or undef if not. Note the second argument is not required.
+success or undef if not. Note the second argument is ignored if provided.
Use this with even more caution than the regex version.
=back
@@ -369,6 +372,10 @@ to do so. And
gets the factory settings back.
+Note that define_alias() will not be able to override the canonical name
+of encodings. Encodings are first looked up by canonical name before
+potential aliases are tried.
+
=head1 SEE ALSO
L<Encode>, L<Encode::Supported>
diff --git a/cpan/Encode/lib/Encode/MIME/Header.pm b/cpan/Encode/lib/Encode/MIME/Header.pm
index 5f209b2bd5..c41797c703 100644
--- a/cpan/Encode/lib/Encode/MIME/Header.pm
+++ b/cpan/Encode/lib/Encode/MIME/Header.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
no warnings 'redefine';
-our $VERSION = do { my @r = ( q$Revision: 2.12 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
+our $VERSION = do { my @r = ( q$Revision: 2.13 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
use Encode qw(find_encoding encode_utf8 decode_utf8);
use MIME::Base64;
use Carp;
@@ -95,7 +95,7 @@ sub decode_q {
my $especials =
join( '|' => map { quotemeta( chr($_) ) }
- unpack( "C*", qq{()<>@,;:"'/[]?.=} ) );
+ unpack( "C*", qq{()<>,;:"'/[]?=} ) );
my $re_encoded_word = qr{
=\? # begin encoded word
diff --git a/cpan/Encode/lib/Encode/Unicode/UTF7.pm b/cpan/Encode/lib/Encode/Unicode/UTF7.pm
index 151917cc56..1d63962754 100644
--- a/cpan/Encode/lib/Encode/Unicode/UTF7.pm
+++ b/cpan/Encode/lib/Encode/Unicode/UTF7.pm
@@ -1,5 +1,5 @@
#
-# $Id: UTF7.pm,v 2.5 2010/09/18 18:39:51 dankogai Exp dankogai $
+# $Id: UTF7.pm,v 2.5 2010/09/18 18:39:51 dankogai Exp $
#
package Encode::Unicode::UTF7;
use strict;
diff --git a/cpan/Encode/t/Aliases.t b/cpan/Encode/t/Aliases.t
index fd088d5275..d7a72d2761 100644
--- a/cpan/Encode/t/Aliases.t
+++ b/cpan/Encode/t/Aliases.t
@@ -16,6 +16,7 @@ use strict;
use Encode;
use Encode::Alias;
my %a2c;
+my @override_tests;
my $ON_EBCDIC;
sub init_a2c{
@@ -108,6 +109,14 @@ BEGIN{
@ARGV and $ON_EBCDIC = $ARGV[0] eq 'EBCDIC';
$Encode::ON_EBCDIC = $ON_EBCDIC;
init_a2c();
+ @override_tests = qw(
+ myascii:cp1252
+ mygreek:cp1253
+ myhebrew:iso-8859-2
+ myarabic:cp1256
+ ueightsomething:utf-8-strict
+ unknown:
+ );
}
if ($ON_EBCDIC){
@@ -120,7 +129,7 @@ if ($ON_EBCDIC){
};
}
-use Test::More tests => (scalar keys %a2c) * 4;
+use Test::More tests => (scalar keys %a2c) * 3 + @override_tests;
print "# alias test; \$ON_EBCDIC == $ON_EBCDIC\n";
@@ -134,20 +143,29 @@ foreach my $a (keys %a2c){
# now we override some of the aliases and see if it works fine
define_alias(
- qr/ascii/i => 'WinLatin1',
- qr/cyrillic/i => 'WinCyrillic',
- qr/arabic/i => 'WinArabic',
- qr/greek/i => 'WinGreek',
- qr/hebrew/i => 'WinHebrew'
+ qr/ascii/i => '"WinLatin1"',
+ qr/cyrillic/i => '"WinCyrillic"',
+ qr/arabic/i => '"WinArabic"',
+ qr/greek/i => '"WinGreek"',
+ qr/hebrew/i => '"WinHebrew"'
);
+Encode::find_encoding("myhebrew"); # polute alias cache
+
+define_alias( sub {
+ my $enc = shift;
+ return "iso-8859-2" if $enc =~ /hebrew/i;
+ return "does-not-exist" if $enc =~ /arabic/i; # should then use other override alias
+ return "utf-8" if $enc =~ /eight/i;
+ return;
+});
+
print "# alias test with alias overrides\n";
-foreach my $a (keys %a2c){
- print "# $a => $a2c{$a}\n";
+for my $test (@override_tests) {
+ my($a, $c) = split /:/, $test;
my $e = Encode::find_encoding($a);
- is((defined($e) and $e->name), $a2c{$a}, "Override $a")
- or warn "alias was $a";
+ is((defined($e) and $e->name), $c, $a);
}
print "# alias undef test\n";
diff --git a/cpan/Encode/t/mime-header.t b/cpan/Encode/t/mime-header.t
index 246eb46647..a444d437e8 100644
--- a/cpan/Encode/t/mime-header.t
+++ b/cpan/Encode/t/mime-header.t
@@ -1,5 +1,5 @@
#
-# $Id: mime-header.t,v 2.5 2010/09/18 18:39:51 dankogai Exp dankogai $
+# $Id: mime-header.t,v 2.5 2010/09/18 18:39:51 dankogai Exp $
# This script is written in utf8
#
BEGIN {
diff --git a/cpan/Encode/t/utf8ref.t b/cpan/Encode/t/utf8ref.t
index 57cfcbcc96..3253e08639 100644
--- a/cpan/Encode/t/utf8ref.t
+++ b/cpan/Encode/t/utf8ref.t
@@ -1,5 +1,5 @@
#
-# $Id: utf8ref.t,v 1.1 2010/09/18 18:39:51 dankogai Exp dankogai $
+# $Id: utf8ref.t,v 1.1 2010/09/18 18:39:51 dankogai Exp $
#
use strict;
diff --git a/cpan/Encode/ucm/nextstep.ucm b/cpan/Encode/ucm/nextstep.ucm
index 2ec37ad296..edf1782814 100644
--- a/cpan/Encode/ucm/nextstep.ucm
+++ b/cpan/Encode/ucm/nextstep.ucm
@@ -1,5 +1,5 @@
#
-# $Id: nextstep.ucm,v 2.1 2010/09/18 18:39:51 dankogai Exp dankogai $
+# $Id: nextstep.ucm,v 2.1 2010/09/18 18:39:51 dankogai Exp $
#
# Original table can be obtained at
# http://www.unicode.org/Public/MAPPINGS/VENDORS/NEXT/NEXTSTEP.TXT