diff options
author | Nicholas Clark <nick@ccl4.org> | 2004-10-10 15:03:25 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-10-10 15:03:25 +0000 |
commit | b4ebbc942f328f1a36f70b899d9165fa73484cd8 (patch) | |
tree | 168f3bf52c242d43c675220f7c589db6ab25e577 /lib/open.pm | |
parent | 0c0f82231532c76a9c20f1dd989b3e879c19a114 (diff) | |
download | perl-b4ebbc942f328f1a36f70b899d9165fa73484cd8.tar.gz |
Restore runtime loading of Encode and Encode-related modules, so that
open.pm will work when the Encode extension isn't build.
p4raw-id: //depot/perl@23355
Diffstat (limited to 'lib/open.pm')
-rw-r--r-- | lib/open.pm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/open.pm b/lib/open.pm index 092ec48d91..4515899461 100644 --- a/lib/open.pm +++ b/lib/open.pm @@ -7,13 +7,10 @@ our $VERSION = '1.04'; require 5.008001; # for PerlIO::get_layers() -use Encode qw(resolve_alias); - -use encoding ':_get_locale_encoding'; -my $locale_encoding = _get_locale_encoding(); +my $locale_encoding; sub _get_encname { - return ($1, resolve_alias($1)) if $_[0] =~ /^:?encoding\((.+)\)$/; + return ($1, Encode::resolve_alias($1)) if $_[0] =~ /^:?encoding\((.+)\)$/; return; } @@ -39,6 +36,7 @@ sub _drop_oldenc { return unless @old >= 3 && $old[-1] eq 'utf8' && $old[-2] =~ /^encoding\(.+\)$/; + require Encode; my ($loname, $lcname) = _get_encname($old[-2]); unless (defined $lcname) { # Should we trust get_layers()? require Carp; @@ -77,7 +75,8 @@ sub import { $layer =~ s/^://; if ($layer eq 'locale') { require Encode; - $locale_encoding = _get_locale_encoding() + require encoding; + $locale_encoding = encoding::_get_locale_encoding() unless defined $locale_encoding; (warnings::warnif("layer", "Cannot figure out an encoding to use"), last) unless defined $locale_encoding; |