Bug#762259: libwww-mechanize-perl: test suite: Use of the encoding pragma is deprecated

Niko Tyni ntyni at debian.org
Sat Sep 20 08:44:35 UTC 2014


Package: libwww-mechanize-perl
Version: 1.73-1
Tags: upstream
Forwarded: https://code.google.com/p/www-mechanize/issues/detail?id=261&q=encoding
User: debian-perl at lists.debian.org
Usertags: perl-5.20-transition

The test suite of libwww-mechanize-perl generates messages like

 t/local/follow.t .. Use of the encoding pragma is deprecated at t/local/follow.t line 8.
 t/local/follow.t .. 1/28 Use of the encoding pragma is deprecated at /home/niko/tmp/libwww-mechanize-perl/t/local/log-server line 6.

Quoting the documentation for the encoding pragma:

    This module is deprecated under perl 5.18. It uses a mechanism
    provided by perl that is deprecated under 5.18 and higher, and may
    be removed in a future version.

The usage, at least in t/local/log-server, which is the more common
of the two, is something of a mess. It has

 use encoding 'iso-8859-1';
 [...]
 binmode DATA,':encoding(iso-8859-1)';
 my $body = join "", <DATA>;

with latin1 characters in the __DATA__ section.

I'm not sure if this actually works; possibly two "errors" cancel each
other out. AFAICS "use encoding" transforms the latin1 characters into
utf8, then reading <DATA> with latin1 encoding gets the two bytes of
the utf8 representation into separate characters. This seems broken to me.

My attempts at fixing this lead to t/local/get.t disagreeing about the
number of bytes returned, and changing that part risks subverting the
meaning of the tests, so I'm leaving it as-is for now.

We can revisit it if 'use encoding' is actually dropped in a future
Perl release.
-- 
Niko Tyni   ntyni at debian.org



More information about the pkg-perl-maintainers mailing list