From: Jarkko Hietaniemi Date: Sat, 10 Nov 2001 17:44:27 +0000 (+0000) Subject: The KOI8-R example wasn't quite right. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dbd62f414cac56dcd537fb1e86d4b5fd38e7dfa6;p=p5sagit%2Fp5-mst-13.2.git The KOI8-R example wasn't quite right. p4raw-id: //depot/perl@12934 --- diff --git a/lib/open.pm b/lib/open.pm index 1c42b8a..6be8b97 100644 --- a/lib/open.pm +++ b/lib/open.pm @@ -153,12 +153,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 close O; open(I, "), "\n"; # this should print 0xC1 + printf "%#X\n", ord(), "\n"; # this should print 0xC1 close I; These are equivalent diff --git a/lib/open.t b/lib/open.t index 3113eff..77587cb 100644 --- a/lib/open.t +++ b/lib/open.t @@ -85,11 +85,12 @@ like( $@, qr/too ambiguous/, 'should die with ambiguous locale encoding' ); %%% # the special :locale layer $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 close O; open(I, "), 0xC1, ":locale"); +printf "%#X\n", ord(), "\n"; # this should print 0xC1 close I; %%%