Subject: | Mistakenly including non .pm files when using require => 1 |
When using the "use Module::Pluggable require => 1", M::B mistakenly
returns directories from the plugins() method. This is a regression
from v2.97 and is causing test failures in Perl::Critic.
Here's a simplified test case that demonstrates the problem:
% mkdir -p lib/Foo/Plugin/Subdir
% cat > lib/Foo.pm
package Foo;
use Module::Pluggable;
print "$_\n" for plugins();
1;
% cat > lib/Foo/Plugin/Subdir/Bar.pm
package Foo::Plugin::Subdir::Bar;
1;
% perl -Ilib -e 'use Foo'
Foo::Plugin::Subdir::Bar
% cat >! lib/Foo.pm
package Foo;
use Module::Pluggable require => 1;
print "$_\n" for plugins();
1;
% perl -Ilib -e 'use Foo'
Foo::Plugin::Subdir
Foo::Plugin::Subdir::Bar
The failure is that plugins() returns "Foo::Plugin::Subdir" in the
latter case. I believe the bug is in Devel::InnerPackage. The
following example demonstrates the spurious return of the subdir:
% perl -Ilib -le'use Devel::InnerPackage;require
Foo::Plugin::Subdir::Bar;print for Devel::InnerPackage::list_packages
"Foo::Plugin";'
Foo::Plugin::Subdir
Foo::Plugin::Subdir::Bar
This should instead return just "Foo::Plugin::Subdir::Bar", I believe.
-- Chris