Skip Menu |

This queue is for tickets about the Test-Compile CPAN distribution.

Report information
The Basics
Id: 122757
Status: resolved
Priority: 0/
Queue: Test-Compile

People
Owner: Nobody in particular
Requestors: s.zuban [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: v2.2.2



Subject: not working with perl 5.16
Date: Wed, 9 Aug 2017 13:43:09 -0700
To: bug-Test-Compile [...] rt.cpan.org
From: Sergiy Zuban <s.zuban [...] gmail.com>
perl 5.16.3 seems to have a bug in pp_hot.c, in S_method_common() proc. Attempt to call a method on a package that starts with semicolons fails. $ perl -E 'say ::foo->require' Can't call method "require" without a package or object reference at -e line 1. With perl 5.18.2 it works fine: $ perl -E 'say ::foo->require' Can't locate object method "require" via package "::foo" (perhaps you forgot to load "::foo"?) at -e line 1. Sergiy Zuban
On Wed Aug 09 16:43:57 2017, s.zuban@gmail.com wrote: Show quoted text
> perl 5.16.3 seems to have a bug in pp_hot.c, in S_method_common() proc. > Attempt to call a method on a package that starts with semicolons fails.
More precisely, it was a design flaw, and a very longstanding one. Show quoted text
> > $ perl -E 'say ::foo->require' > Can't call method "require" without a package or object reference at -e > line 1. > > With perl 5.18.2 it works fine: > > $ perl -E 'say ::foo->require' > Can't locate object method "require" via package "::foo" (perhaps you > forgot to load "::foo"?) at -e line 1.
For me Test::Compile passes its tests on 5.12, and I do not see such ::package->method usage anywhere in the tarball. Did you perhaps report this against the wrong module?
Subject: Re: [rt.cpan.org #122757] not working with perl 5.16
Date: Sun, 13 Aug 2017 09:08:23 -0700
To: bug-Test-Compile [...] rt.cpan.org
From: Sergiy Zuban <s.zuban [...] gmail.com>
Show quoted text
> > For me Test::Compile passes its tests on 5.12, and I do not see such > ::package->method usage anywhere in the tarball. > > Did you perhaps report this against the wrong module? >
It's in Test::Compile::Internal::pm_file_compiles. The following code converts absolute file name to a package name by replacing / with :: So */foo/bar/lib/Test.pm* becomes *::foo::bar::Test* and then we expect that Perl recognizes *::foo::bar::Test->import* as a method call, but it does not work for 5.16 my $module = $file; $module =~ s!^(blib[/\\])?lib[/\\]!!; $module =~ s![/\\]!::!g; $module =~ s/\.pm$//; return 1 if $module->require; My test script is super simple: use Test::Compile; my $test = Test::Compile->new(); $test->all_files_ok("/foo/bar/lib"); $test->done_testing();
Subject: Re: [rt.cpan.org #122757] not working with perl 5.16
Date: Mon, 14 Aug 2017 08:49:06 -0700
To: bug-Test-Compile [...] rt.cpan.org
From: Sergiy Zuban <s.zuban [...] gmail.com>
one correction - lib is actually included in package name, i.e. it tries to call ::foo::bar::lib::Test->import and fails Sergiy Zuban On Sun, Aug 13, 2017 at 9:08 AM, Sergiy Zuban <s.zuban@gmail.com> wrote: Show quoted text
> For me Test::Compile passes its tests on 5.12, and I do not see such
>> ::package->method usage anywhere in the tarball. >> >> Did you perhaps report this against the wrong module? >>
> > It's in Test::Compile::Internal::pm_file_compiles. The following code > converts absolute file name to a package name by replacing / with :: > So */foo/bar/lib/Test.pm* becomes *::foo::bar::Test* and then we expect > that Perl recognizes *::foo::bar::Test->import* as a method call, but it > does not work for 5.16 > > my $module = $file; > > $module =~ s!^(blib[/\\])?lib[/\\]!!; > > $module =~ s![/\\]!::!g; > > $module =~ s/\.pm$//; > > return 1 if $module->require; > > My test script is super simple: > > use Test::Compile; > > my $test = Test::Compile->new(); > > $test->all_files_ok("/foo/bar/lib"); > > $test->done_testing(); >
On Sun Aug 13 12:09:14 2017, s.zuban@gmail.com wrote: Show quoted text
> > > > For me Test::Compile passes its tests on 5.12, and I do not see such > > ::package->method usage anywhere in the tarball. > > > > Did you perhaps report this against the wrong module? > >
> > It's in Test::Compile::Internal::pm_file_compiles. The following code > converts absolute file name to a package name by replacing / with :: > So */foo/bar/lib/Test.pm* becomes *::foo::bar::Test* and then we expect > that Perl recognizes *::foo::bar::Test->import* as a method call, but it > does not work for 5.16 > > my $module = $file; > > $module =~ s!^(blib[/\\])?lib[/\\]!!; > > $module =~ s![/\\]!::!g; > > $module =~ s/\.pm$//; > > return 1 if $module->require;
Yes, I see. If pm_file_compiles expects a file name, it really should just use ‘require $file’ instead of munging into a module name, only for UNIVERSAL::require to munge it back!
Hi Test::Compile no longer munges the filename to try to require a module, I *think* that should resolve this issue, but please feel free to re open if not. Thanks