Skip Menu |

This queue is for tickets about the Module-Pluggable CPAN distribution.

Report information
The Basics
Id: 43767
Status: resolved
Priority: 0/
Queue: Module-Pluggable

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

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



Subject: M::P requires files that are excluded via only/except
Hi simon, take a look at the below script + terminal output. You'll see that only one of the 2 files created should be loaded. The _dist_types method returns the right one, BUT both are being require'd. That's because the require code is part of this call: my @plugins = $self->search_directories(@SEARCHDIR); high up in M::P::Object->plugins. The exception are only applied AFTER this call, which means it's too late to exclude them from being required. This bug is causing some annoying warnings in bleadperl and is standing in the way of a nice 5.10.1 release. If you could address this, that'd be much appreciated. Cheers, P.S the CORE warning comes from: eval "CORE::require $pack"; which should probably be written as: eval "CORE::require( $pack )"; ================================ package Foo; use strict; use Data::Dumper; require Module::Pluggable; my $only_re = __PACKAGE__ . '::\w+$'; Module::Pluggable->import( sub_name => '_dist_types', search_path => __PACKAGE__, only => qr/$only_re/, require => 1, ); warn Dumper __PACKAGE__->_dist_types; __END__ [kane@myriad-wifi ~...perl/module-pluggable-require-bug]$ bbedit x.pl [kane@myriad-wifi ~...perl/module-pluggable-require-bug]$ mkdir Foo [kane@myriad-wifi ~...perl/module-pluggable-require-bug]$ touch Foo/Bar.pm [kane@myriad-wifi ~...perl/module-pluggable-require-bug]$ touch Foo/.Zot.pm [kane@myriad-wifi ~...perl/module-pluggable-require-bug]$ perlc x.pl Warning: Use of "CORE" without parentheses is ambiguous at (eval 13) line 1. Couldn't require Foo::.Zot : Bareword "Zot" not allowed while "strict subs" in use at (eval 13) line 1. at /opt/lib/perl5/site_perl/5.8.8/Module/Pluggable.pm line 28 Couldn't require Foo::Bar : Foo/Bar.pm did not return a true value at (eval 14) line 3. at /opt/lib/perl5/site_perl/5.8.8/Module/Pluggable.pm line 28 $VAR1 = 'Foo::Bar'; [kane@myriad-wifi ~...perl/module-pluggable-require-bug]$ perlc -le'print 1 if "." =~ /\w/' [kane@myriad-wifi ~...perl/module-pluggable-require-bug]$
I think this is fixed in svn. https://svn.unixbeard.net/simon/Module-Pluggable/ There's a new test t/12onlyrequire.t which attempts to replicate the problem.
On Mon Mar 02 14:02:13 2009, SIMONW wrote: Show quoted text
> I think this is fixed in svn. > > https://svn.unixbeard.net/simon/Module-Pluggable/ > > There's a new test t/12onlyrequire.t which attempts to replicate the > problem.
This is not fixed as of version 3.8.
3.8 is a year old - I've just uploaded 3.9 with the necessary patches to CPAN.