Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 122167
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

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



Subject: use parent q{Encode::Encoding}; fails: Can't locate object method "Define" via package "Encode::utf8"
Since this commit (first in 2.90): commit 55364c9dfa1e3ce611cdff08fc576c86a0bdcdf4 Author: Pali <pali@cpan.org> Date: Wed May 31 22:35:31 2017 +0200 Remove no warnings 'redefine'; and correctly load dependences Calling no warnings 'redefine'; just hide a read problem that one function is later redefined by another. Such thing should not happen, and if there is it should be fixed. The real problem is exporting all Encode functions into used modules, including functions encode() and decode(). Correct way is to export only those functions which are really needed by modules. Or to call Encode function with whole package name (e.g. Encode::find_encoding). Another problem is time when Encode module is loaded. By calling require it is done at runtime, after current file was already parsed. It is too late specially for prototyped functions and also constant. Calling use instead of require fixes this problem. After those fixes no warnings 'redefine'; can be removed and modules are warning-free. Various Encode-related distributions fails to build because Define() method does not exist when loading Encode::Encoding: $ perl -Iblib/{lib,arch} -e 'package Encode::Foo; use parent q{Encode::Encoding};' Can't locate object method "Define" via package "Encode::utf8" at blib/lib/Encode.pm line 347. Compilation failed in require at blib/lib/Encode/Encoding.pm line 11. BEGIN failed--compilation aborted at blib/lib/Encode/Encoding.pm line 11. Compilation failed in require at /usr/share/perl5/vendor_perl/parent.pm line 16. BEGIN failed--compilation aborted at -e line 1. The test case is a reduced code from Encode::Encoding POD.
Looks like 2.90 has introduced a chicken-vs-egg problem between Encode and Encode::Encoding. I have fixed it by removing ->Define in Encode::utf8. https://github.com/dankogai/p5-encode/commit/208d094b8cf82da488495400ea9a518841fd007a Encode::VERSION++ will follow soon. Thank you for reporting. Dan the Maintainer Thereof On Thu Jun 22 02:30:11 2017, ppisar wrote: Show quoted text
> Since this commit (first in 2.90): > > commit 55364c9dfa1e3ce611cdff08fc576c86a0bdcdf4 > Author: Pali <pali@cpan.org> > Date: Wed May 31 22:35:31 2017 +0200 > > Remove no warnings 'redefine'; and correctly load dependences > > Calling no warnings 'redefine'; just hide a read problem that one > function > is later redefined by another. Such thing should not happen, and if > there > is it should be fixed. > > The real problem is exporting all Encode functions into used modules, > including functions encode() and decode(). Correct way is to export > only > those functions which are really needed by modules. Or to call Encode > function with whole package name (e.g. Encode::find_encoding). > > Another problem is time when Encode module is loaded. By calling > require it > is done at runtime, after current file was already parsed. It is too > late > specially for prototyped functions and also constant. Calling use > instead > of require fixes this problem. > > After those fixes no warnings 'redefine'; can be removed and modules > are > warning-free. > > Various Encode-related distributions fails to build because Define() > method does not exist when loading Encode::Encoding: > > $ perl -Iblib/{lib,arch} -e 'package Encode::Foo; use parent > q{Encode::Encoding};' > Can't locate object method "Define" via package "Encode::utf8" at > blib/lib/Encode.pm line 347. > Compilation failed in require at blib/lib/Encode/Encoding.pm line 11. > BEGIN failed--compilation aborted at blib/lib/Encode/Encoding.pm line > 11. > Compilation failed in require at > /usr/share/perl5/vendor_perl/parent.pm line 16. > BEGIN failed--compilation aborted at -e line 1. > > The test case is a reduced code from Encode::Encoding POD.