X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fopen.pm;h=b535d88239a75507a773fb5db1e6546441ffc3f6;hb=9c1370fb202eb56860da11d7695c846c33542694;hp=79cd61b2338b036564bd0e239c53c887544a6b4c;hpb=276c9210946afd5a25f08e38e69079c3d3456630;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/open.pm b/lib/open.pm index 79cd61b..b535d88 100644 --- a/lib/open.pm +++ b/lib/open.pm @@ -11,9 +11,13 @@ sub in_locale { $^H & $locale::hint_bits } sub _get_locale_encoding { unless (defined $locale_encoding) { # I18N::Langinfo isn't available everywhere - eval "use I18N::Langinfo qw(langinfo CODESET)"; - unless ($@) { + eval { + require I18N::Langinfo; + I18N::Langinfo->import(qw(langinfo CODESET)); $locale_encoding = langinfo(CODESET()); + }; + unless ($@) { + print "# locale_encoding = $locale_encoding\n"; } my $country_language; if (not $locale_encoding && in_locale()) { @@ -62,7 +66,7 @@ sub import { $type = 'IO'; $dscp = ":$1"; } else { - $dscp = shift(@args); + $dscp = shift(@args) || ''; } my @val; foreach my $layer (split(/\s+/,$dscp)) { @@ -119,7 +123,7 @@ open - perl pragma to set default disciplines for input and output use open IO => ":encoding(iso-8859-7)"; use open IO => ':locale'; - + use open ':utf8'; use open ':locale'; use open ':encoding(iso-8859-7)'; @@ -139,7 +143,7 @@ operators found within the lexical scope of this pragma will use the declared defaults. With the C subpragma you can declare the default layers -of input sterams, and with the C subpragma you can declare +of input streams, and with the C subpragma you can declare the default layers of output streams. With the C subpragma you can control both input and output streams simultaneously.