In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a89802816ca9b489a3239d20e67e3d724a0f78ca?hp=1fb23c72f01044b382871df38d6a63287edccf14>
- Log ----------------------------------------------------------------- commit a89802816ca9b489a3239d20e67e3d724a0f78ca Author: Pali <[email protected]> Date: Sun Sep 18 17:16:33 2016 +0200 pod: Do not suggest to use insecure :utf8 PerlIO layer when reading files Instead use strict :encoding(UTF-8) PerlIO layer for input files. ----------------------------------------------------------------------- Summary of changes: pod/perlop.pod | 9 ++++++--- pod/perlunicook.pod | 12 ++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 6550133284..7df98f716d 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1268,16 +1268,19 @@ The only operators with lower precedence are the logical operators C<"and">, C<"or">, and C<"not">, which may be used to evaluate calls to list operators without the need for parentheses: - open HANDLE, "< :utf8", "filename" or die "Can't open: $!\n"; + open HANDLE, "< :encoding(UTF-8)", "filename" + or die "Can't open: $!\n"; However, some people find that code harder to read than writing it with parentheses: - open(HANDLE, "< :utf8", "filename") or die "Can't open: $!\n"; + open(HANDLE, "< :encoding(UTF-8)", "filename") + or die "Can't open: $!\n"; in which case you might as well just use the more customary C<"||"> operator: - open(HANDLE, "< :utf8", "filename") || die "Can't open: $!\n"; + open(HANDLE, "< :encoding(UTF-8)", "filename") + || die "Can't open: $!\n"; See also discussion of list operators in L</Terms and List Operators (Leftward)>. diff --git a/pod/perlunicook.pod b/pod/perlunicook.pod index 9a8d4daaa8..eb395f795e 100644 --- a/pod/perlunicook.pod +++ b/pod/perlunicook.pod @@ -26,7 +26,7 @@ to work correctly, with the C<#!> adjusted to work on your system: use strict; # quote strings, declare variables use warnings; # on by default use warnings qw(FATAL utf8); # fatalize encoding glitches - use open qw(:std :utf8); # undeclared streams in UTF-8 + use open qw(:std :encoding(UTF-8)); # undeclared streams in UTF-8 use charnames qw(:full :short); # unneeded in v5.16 This I<does> make even Unix programmers C<binmode> your binary streams, @@ -255,9 +255,9 @@ call C<binmode> explicitly: or $ export PERL_UNICODE=S or - use open qw(:std :utf8); + use open qw(:std :encoding(UTF-8)); or - binmode(STDIN, ":utf8"); + binmode(STDIN, ":encoding(UTF-8)"); binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); @@ -280,7 +280,7 @@ Files opened without an encoding argument will be in UTF-8: or $ export PERL_UNICODE=D or - use open qw(:utf8); + use open qw(:encoding(UTF-8)); =head2 â 18: Make all I/O and args default to utf8 @@ -288,7 +288,7 @@ Files opened without an encoding argument will be in UTF-8: or $ export PERL_UNICODE=SDA or - use open qw(:std :utf8); + use open qw(:std :encoding(UTF-8)); use Encode qw(decode); @ARGV = map { decode('UTF-8', $_, 1) } @ARGV; @@ -701,7 +701,7 @@ Here's that program; tested on v5.14. use strict; use warnings; use warnings qw(FATAL utf8); # fatalize encoding faults - use open qw(:std :utf8); # undeclared streams in UTF-8 + use open qw(:std :encoding(UTF-8)); # undeclared streams in UTF-8 use charnames qw(:full :short); # unneeded in v5.16 # std modules -- Perl5 Master Repository
