summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Encode/Alias.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Encode/Alias.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/Encode/Alias.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/Master/tlpkg/tlperl/lib/Encode/Alias.pm b/Master/tlpkg/tlperl/lib/Encode/Alias.pm
index 04ad4967c98..0a252560f5d 100644
--- a/Master/tlpkg/tlperl/lib/Encode/Alias.pm
+++ b/Master/tlpkg/tlperl/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.20 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
+our $VERSION = do { my @r = ( q$Revision: 2.21 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG};
use Exporter 'import';
@@ -79,8 +79,10 @@ sub find_alias {
sub define_alias {
while (@_) {
- my ( $alias, $name ) = splice( @_, 0, 2 );
- unshift( @Alias, $alias => $name ); # newer one has precedence
+ my $alias = shift;
+ my $name = shift;
+ unshift( @Alias, $alias => $name ) # newer one has precedence
+ if defined $alias;
if ( ref($alias) ) {
# clear %Alias cache to allow overrides
@@ -96,10 +98,14 @@ sub define_alias {
}
}
}
- else {
+ elsif (defined $alias) {
DEBUG and warn "delete \$Alias\{$alias\}";
delete $Alias{$alias};
}
+ elsif (DEBUG) {
+ require Carp;
+ Carp::croak("undef \$alias");
+ }
}
}