Tweaks by Autrijus Tang.
[p5sagit/p5-mst-13.2.git] / ext / Encode / encoding.pm
index 1b3dd84..16dee96 100644 (file)
@@ -1,7 +1,8 @@
 package encoding;
-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.25 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
 
 use Encode;
+use strict;
 
 BEGIN {
     if (ord("A") == 193) {
@@ -28,9 +29,9 @@ sub import {
        if ($arg{$h}){
            unless (defined find_encoding($name)) {
                require Carp;
-               Carp::croak "Unknown encoding for $fhname, '$arg{$h}'";
+               Carp::croak "Unknown encoding for $h, '$arg{$h}'";
            }
-           eval qq{ binmode($h, ":encoding($arg{h})") };
+           eval qq{ binmode($h, ":encoding($arg{$h})") };
        }else{
            eval qq{ binmode($h, ":encoding($name)") };
        }
@@ -47,7 +48,8 @@ sub unimport{
     undef ${^ENCODING};
     binmode(STDIN,  ":raw");
     binmode(STDOUT, ":raw");
-    binmode(STDERR, ":raw");
+    # Leaves STDERR alone.
+    # binmode(STDERR, ":raw");
 }
 
 1;
@@ -121,7 +123,8 @@ You can override this by giving extra arguments.  See below.
 =item use encoding [I<ENCNAME>] ;
 
 Sets the script encoding to I<ENCNAME> and file handle disciplines of
-STDIN, STDOUT, and STDERR are set to ":encoding(I<ENCNAME>)". 
+STDIN, STDOUT are set to ":encoding(I<ENCNAME>)". Note STDERR will not 
+be changed.
 
 If no encoding is specified, the environment variable L<PERL_ENCODING>
 is consulted. If no  encoding can be found, C<Unknown encoding 'I<ENCNAME>'>
@@ -138,8 +141,8 @@ first I<ENCNAME>.
 
 =item no encoding;
 
-Unsets the script encoding and the disciplines of STDIN, STDOUT, and
-STDERR are reset to ":raw".
+Unsets the script encoding and the disciplines of STDIN, STDOUT are
+reset to ":raw".
 
 =back