Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

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

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

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



Subject: enc2xs -C fails if URL::Encode::XS is installed
Running enc2xs -C fails on one of my systems: $ /opt/perl-5.18.4/bin/enc2xs -C require Encode; ... require Encode::XS; Can't require Encode::XS: Can't locate Encode/XS.pm in @INC (you may need to install the Encode::XS module) (@INC contains: /opt/perl-5.18.4/lib/site_perl/5.18.4/x86_64-linux /opt/perl-5.18.4/lib/site_perl/5.18.4 /opt/perl-5.18.4/lib/5.18.4/x86_64-linux /opt/perl-5.18.4/lib/5.18.4 .) at (eval 39) line 1. There's no Encode::XS installed here, but instead it seems that URL::Encode::XS is wrongly recognized as Encode::XS. A possible solution for make_configlocal_pm, as untested (!) pseudo code: for $incdir (@INC) { $encdir = File::Spec->catpath($incdir, 'Encode'); if (-d $encdir) { find $wanted, $encdir; } } And rewrite the path2mod conversion code in $wanted to just strip $incdir: $mod = substr($File::Find::name, length($incdir)+1); $mod =~ s{/}{::}g; $mod =~ s{\.pmz}{};
On 2014-12-02 02:28:29, SREZIC wrote: Show quoted text
> Running enc2xs -C fails on one of my systems: > > $ /opt/perl-5.18.4/bin/enc2xs -C > require Encode; > ... > require Encode::XS; > Can't require Encode::XS: Can't locate Encode/XS.pm in @INC (you may > need to install the Encode::XS module) (@INC contains: /opt/perl- > 5.18.4/lib/site_perl/5.18.4/x86_64-linux /opt/perl- > 5.18.4/lib/site_perl/5.18.4 /opt/perl-5.18.4/lib/5.18.4/x86_64-linux > /opt/perl-5.18.4/lib/5.18.4 .) at (eval 39) line 1. > > There's no Encode::XS installed here, but instead it seems that > URL::Encode::XS is wrongly recognized as Encode::XS. > > A possible solution for make_configlocal_pm, as untested (!) pseudo > code: > > for $incdir (@INC) { > $encdir = File::Spec->catpath($incdir, 'Encode'); > if (-d $encdir) { > find $wanted, $encdir; > } > } > > And rewrite the path2mod conversion code in $wanted to just strip > $incdir: > > $mod = substr($File::Find::name, length($incdir)+1); > $mod =~ s{/}{::}g; > $mod =~ s{\.pmz}{};
And using something like for $incdir (grep { $_ ne "." } @INC) would also fix RT #64585.
SREZIC, Would you check to see if the following patch fix that? https://github.com/dankogai/p5-encode/commit/1dc34a2de07c0a5e378542b1ec0dc9007928e8df Instead of croaking on require-ing non-existent module, it simply skips now. With your confirmation I'll Encode::VERSION++ ASAP. Thank you for finding this embarrassing bug. Doubly embarrassing because I am also an author of URL::Encode::XS . Dan the Maintainer Thereof On Tue Dec 02 02:42:57 2014, SREZIC wrote: Show quoted text
> On 2014-12-02 02:28:29, SREZIC wrote:
> > Running enc2xs -C fails on one of my systems: > > > > $ /opt/perl-5.18.4/bin/enc2xs -C > > require Encode; > > ... > > require Encode::XS; > > Can't require Encode::XS: Can't locate Encode/XS.pm in @INC (you may > > need to install the Encode::XS module) (@INC contains: /opt/perl- > > 5.18.4/lib/site_perl/5.18.4/x86_64-linux /opt/perl- > > 5.18.4/lib/site_perl/5.18.4 /opt/perl-5.18.4/lib/5.18.4/x86_64-linux > > /opt/perl-5.18.4/lib/5.18.4 .) at (eval 39) line 1. > > > > There's no Encode::XS installed here, but instead it seems that > > URL::Encode::XS is wrongly recognized as Encode::XS. > > > > A possible solution for make_configlocal_pm, as untested (!) pseudo > > code: > > > > for $incdir (@INC) { > > $encdir = File::Spec->catpath($incdir, 'Encode'); > > if (-d $encdir) { > > find $wanted, $encdir; > > } > > } > > > > And rewrite the path2mod conversion code in $wanted to just strip > > $incdir: > > > > $mod = substr($File::Find::name, length($incdir)+1); > > $mod =~ s{/}{::}g; > > $mod =~ s{\.pmz}{};
> > And using something like > > for $incdir (grep { $_ ne "." } @INC) > > would also fix RT #64585. >
On 2014-12-02 12:45:18, DANKOGAI wrote: Show quoted text
> SREZIC, > > Would you check to see if the following patch fix that? > > https://github.com/dankogai/p5- > encode/commit/1dc34a2de07c0a5e378542b1ec0dc9007928e8df > > Instead of croaking on require-ing non-existent module, it simply > skips now. > > With your confirmation I'll Encode::VERSION++ ASAP. > > Thank you for finding this embarrassing bug. Doubly embarrassing > because I am also an author of URL::Encode::XS .
A very simple solution, but it seems to work.. Regards, Slaven Show quoted text
> Dan the Maintainer Thereof > > On Tue Dec 02 02:42:57 2014, SREZIC wrote:
> > On 2014-12-02 02:28:29, SREZIC wrote:
> > > Running enc2xs -C fails on one of my systems: > > > > > > $ /opt/perl-5.18.4/bin/enc2xs -C > > > require Encode; > > > ... > > > require Encode::XS; > > > Can't require Encode::XS: Can't locate Encode/XS.pm in @INC (you > > > may > > > need to install the Encode::XS module) (@INC contains: /opt/perl- > > > 5.18.4/lib/site_perl/5.18.4/x86_64-linux /opt/perl- > > > 5.18.4/lib/site_perl/5.18.4 /opt/perl-5.18.4/lib/5.18.4/x86_64- > > > linux > > > /opt/perl-5.18.4/lib/5.18.4 .) at (eval 39) line 1. > > > > > > There's no Encode::XS installed here, but instead it seems that > > > URL::Encode::XS is wrongly recognized as Encode::XS. > > > > > > A possible solution for make_configlocal_pm, as untested (!) pseudo > > > code: > > > > > > for $incdir (@INC) { > > > $encdir = File::Spec->catpath($incdir, 'Encode'); > > > if (-d $encdir) { > > > find $wanted, $encdir; > > > } > > > } > > > > > > And rewrite the path2mod conversion code in $wanted to just strip > > > $incdir: > > > > > > $mod = substr($File::Find::name, length($incdir)+1); > > > $mod =~ s{/}{::}g; > > > $mod =~ s{\.pmz}{};
> > > > And using something like > > > > for $incdir (grep { $_ ne "." } @INC) > > > > would also fix RT #64585. > >
SREZIC, Confirmed the fix did work % sudo enc2xs -C require Encode; require Encode::Alias; require Encode::Byte; #... require Encode::XS; Can't require Encode::XS: Can't locate Encode/XS.pm in @INC (you may need to install the Encode::XS module) (@INC contains: /usr/local/lib/perl5/site_perl/5.20.1/darwin-thread-multi-2level /usr/local/lib/perl5/site_perl/5.20.1 /usr/local/lib/perl5/5.20.1/darwin-thread-multi-2level /usr/local/lib/perl5/5.20.1 .) at (eval 28) line 1. % sudo perl bin/enc2xs -C require Encode; require Encode::Alias; require Encode::Byte; #... require Encode::Unicode::UTF7; $Encode::ExtModule{'big5-1984'} = "Encode::HanExtra"; $Encode::ExtModule{'big5-2003'} = "Encode::HanExtra"; $Encode::ExtModule{'big5ext'} = "Encode::HanExtra"; $Encode::ExtModule{'big5plus'} = "Encode::HanExtra"; $Encode::ExtModule{'cccii'} = "Encode::HanExtra"; $Encode::ExtModule{'cns11643-1'} = "Encode::HanExtra"; $Encode::ExtModule{'cns11643-2'} = "Encode::HanExtra"; $Encode::ExtModule{'cns11643-3'} = "Encode::HanExtra"; $Encode::ExtModule{'cns11643-4'} = "Encode::HanExtra"; $Encode::ExtModule{'cns11643-5'} = "Encode::HanExtra"; $Encode::ExtModule{'cns11643-6'} = "Encode::HanExtra"; $Encode::ExtModule{'cns11643-7'} = "Encode::HanExtra"; $Encode::ExtModule{'cns11643-f'} = "Encode::HanExtra"; $Encode::ExtModule{'euc-tw'} = "Encode::HanExtra"; $Encode::ExtModule{'gb18030'} = "Encode::HanExtra"; $Encode::ExtModule{'unisys'} = "Encode::HanExtra"; $Encode::ExtModule{'unisys-sosi1'} = "Encode::TW::Unisys::SOSI1"; $Encode::ExtModule{'unisys-sosi2'} = "Encode::TW::Unisys::SOSI2"; /usr/local/lib/perl5/site_perl/5.20.1/darwin-thread-multi-2level/Encode /usr/local/lib/perl5/5.20.1/Encode Generating /usr/local/lib/perl5/site_perl/5.20.1/darwin-thread-multi-2level/Encode/ConfigLocal.pm... Thank you again for finding such a subtle bug. And my apology also goes to CHANSEN (who is also a contributor to Encode) who is the REAL author of URL::Escape::XS -- mine is URI::Escape::XS Encode 2.66 is on its way and the case closed. Dan the Maintainer Thereof On Tue Dec 02 16:57:32 2014, SREZIC wrote: Show quoted text
> On 2014-12-02 12:45:18, DANKOGAI wrote:
> > SREZIC, > > > > Would you check to see if the following patch fix that? > > > > https://github.com/dankogai/p5- > > encode/commit/1dc34a2de07c0a5e378542b1ec0dc9007928e8df > > > > Instead of croaking on require-ing non-existent module, it simply > > skips now. > > > > With your confirmation I'll Encode::VERSION++ ASAP. > > > > Thank you for finding this embarrassing bug. Doubly embarrassing > > because I am also an author of URL::Encode::XS .
> > A very simple solution, but it seems to work.. > > Regards, > Slaven >
> > Dan the Maintainer Thereof > > > > On Tue Dec 02 02:42:57 2014, SREZIC wrote:
> > > On 2014-12-02 02:28:29, SREZIC wrote:
> > > > Running enc2xs -C fails on one of my systems: > > > > > > > > $ /opt/perl-5.18.4/bin/enc2xs -C > > > > require Encode; > > > > ... > > > > require Encode::XS; > > > > Can't require Encode::XS: Can't locate Encode/XS.pm in @INC (you > > > > may > > > > need to install the Encode::XS module) (@INC contains: /opt/perl- > > > > 5.18.4/lib/site_perl/5.18.4/x86_64-linux /opt/perl- > > > > 5.18.4/lib/site_perl/5.18.4 /opt/perl-5.18.4/lib/5.18.4/x86_64- > > > > linux > > > > /opt/perl-5.18.4/lib/5.18.4 .) at (eval 39) line 1. > > > > > > > > There's no Encode::XS installed here, but instead it seems that > > > > URL::Encode::XS is wrongly recognized as Encode::XS. > > > > > > > > A possible solution for make_configlocal_pm, as untested (!) pseudo > > > > code: > > > > > > > > for $incdir (@INC) { > > > > $encdir = File::Spec->catpath($incdir, 'Encode'); > > > > if (-d $encdir) { > > > > find $wanted, $encdir; > > > > } > > > > } > > > > > > > > And rewrite the path2mod conversion code in $wanted to just strip > > > > $incdir: > > > > > > > > $mod = substr($File::Find::name, length($incdir)+1); > > > > $mod =~ s{/}{::}g; > > > > $mod =~ s{\.pmz}{};
> > > > > > And using something like > > > > > > for $incdir (grep { $_ ne "." } @INC) > > > > > > would also fix RT #64585.