On Wed Sep 07 16:42:15 2016, SREZIC wrote:
Show quoted text> On 2015-11-22 13:18:40, SREZIC wrote:
>
> With perl 5.25.x, the error message is different:
>
> PERL_DL_NONLAZY=1 "/bbbike/perl-5.25.4/bin/perl5.25.4" "-
> MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef
> *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')"
> t/*.t
> The encoding pragma is no longer supported at t/encoding-stdio-
> notsource.t line 2.
> BEGIN failed--compilation aborted at t/encoding-stdio-notsource.t line
> 2.
> t/encoding-stdio-notsource.t ..
> Dubious, test returned 255 (wstat 65280, 0xff00)
> No subtests run
> The encoding pragma is no longer supported at t/encoding-stdio.t line
> 12.
> BEGIN failed--compilation aborted at t/encoding-stdio.t line 12.
I don’t really understand why this module needed to be written to begin with. It provides the same functionality as the open pragma, but in a very hackish way (including ignoring any Filter arguments explicitly passed, instead of rejecting them).
The attached patch gets it passing tests (but now Filter will die) in a hackish-but-slightly-less-hackish way, but I think it would be better to point users to the open pragma instead.
I am not offering to rewrite the documentation, but I have some comments on it:
Show quoted text> The C<encoding> pragma assumes that the development environment and the
> environment in which the program will run, use the same character encoding.
> Typically, they will be different, but unfortunately, it's too late to change
> C<encoding> now.
We can deprecate encoding. :-)
Show quoted text> We can add new modules, though.
But open.pm already existed.
Show quoted text> C<encoding::stdio> only installs the PerlIO C<:encoding> layers on STDOUT and
> STDIN, without installing a source filter.
>
> See C<encoding::source> by Rafael Garcia-Suarez for handling source encoding
> without touching stdio encodings.
But encoding::source does not handle source encoding per se; rather, it changes the way string are upgraded, breaking assumptions that most code makes (that if ord($a) == ord($b) and both are of length 1, then $a eq $b; this was the main reason encoding got deprecated).
For something that deal *just* with source encoding, see Filter::Encoding, which was written to replace that functionality of encoding.pm.
Show quoted text> See L<encoding> for usage information.
Or, better yet, just use L<open>.