Skip Menu |

This queue is for tickets about the TVGuide-NL CPAN distribution.

Report information
The Basics
Id: 117740
Status: open
Priority: 0/
Queue: TVGuide-NL

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.14
Fixed in: (no value)



Subject: The encoding pragma is no longer supported
With bleadperl (e.g. perl 5.25.4) the encoding pragma cannot be used anymore: Output from '/usr/bin/make': Fetching station information from http://gids.omroep.nl/ The encoding pragma is no longer supported at utils/maketables.pl line 12. BEGIN failed--compilation aborted at utils/maketables.pl line 12. *** Error code 255 Stop. make: stopped in /home/cpansand/.cpan/build/2016091000/TVGuide-NL-0.14-0
On Sat Sep 10 05:49:32 2016, SREZIC wrote: Show quoted text
> With bleadperl (e.g. perl 5.25.4) the encoding pragma cannot be used > anymore: > > Output from '/usr/bin/make': > > Fetching station information from http://gids.omroep.nl/ > The encoding pragma is no longer supported at utils/maketables.pl line > 12. > BEGIN failed--compilation aborted at utils/maketables.pl line 12. > *** Error code 255 > > Stop. > make: stopped in /home/cpansand/.cpan/build/2016091000/TVGuide-NL- > 0.14-0
A local firewall prevents me from accessing gids.omroep.nl, so I cannot provide a patch and be sure that it will work. I can, however, provide guidance on how to move the code away from using encoding.pm. encoding.pm does three different things: 1. It causes the source code to be interpreted as a specific encoding. 2. It hooks the upgrading of strings, having a global effect prior to perl 5.22. 3. It changes the encoding of the standard handles and changes the default encoding of new handles opened within the current lexical scope. Items 2 and 3 make it almost always wrong for a module to ‘use encoding’. Item number 2 results in a broken string model, in which two strings with identical codepoints according to ord() may compare as unequal (eq returns false), depending on the internal encoding. In other words, it will automatically decode strings without warning, but only some strings, not others, making it rather unpredictable, and making it go against the assumptions of most code, including many parts of perl itself. (This is the main reason why the mechanism was deprecated and removed.) If your use of ‘use encoding’ was solely to declare the source as utf8, then ‘use utf8’ was sufficient, and ‘use encoding’ was redundant. If ‘use encoding’ was also intended as a way to set the encoding of STDOUT, which I believe was the intent in utils/maketables.pl, then ‘use open ":std", ":utf8";’ can be used, but the module that utils/maketables.pl writes should not do that, as modules should not be touching standard handles; that is usually the script’s job. If the automatic decoding was relied on anywhere (though I do not believe this to be the case), then a simple ‘utf8::decode($string)’ in the appropriate place will accomplish that. Its return value can be used to determine whether the encoding succeeded. If automatic encoding (à la encoding.pm) is desired, then checking its return value is unnecessary.