Allow several arguments to display().
[p5sagit/p5-mst-13.2.git] / lib / open.pm
index 1c42b8a..79cd61b 100644 (file)
@@ -10,11 +10,8 @@ sub in_locale { $^H & $locale::hint_bits }
 
 sub _get_locale_encoding {
     unless (defined $locale_encoding) {
-       eval {
-           # I18N::Langinfo isn't available everywhere
-           require I18N::Langinfo;
-           I18N::Langinfo->import('langinfo', 'CODESET');
-       };
+       # I18N::Langinfo isn't available everywhere
+       eval "use I18N::Langinfo qw(langinfo CODESET)";
        unless ($@) {
            $locale_encoding = langinfo(CODESET());
        }
@@ -153,12 +150,13 @@ locale environment variables, you can use the C<:locale> tag.
 For example:
 
     $ENV{LANG} = 'ru_RU.KOI8-R';
-    use open ':locale';
+    # the :locale will probe the locale environment variables like LANG
+    use open OUT => ':locale';
     open(O, ">koi8");
-    print O chr(0x430); # Unicode CYRILLIC SMALL LETTER A = KOI8-R 0xC1
+    print O chr(0x430); # Unicode CYRILLIC SMALL LETTER A = KOI8-R 0xc1
     close O;
     open(I, "<koi8");
-    printf "%#x\n", ord(<I>), "\n"; # this should print 0xC1
+    printf "%#x\n", ord(<I>), "\n"; # this should print 0xc1
     close I;
 
 These are equivalent