[jifty-devel] Classloader's loader

John Peacock jpeacock at rowman.com
Mon Oct 23 22:35:43 EDT 2006


Gaal Yahas wrote:
> Jifty::Everything (or probably in a new module required by it):
> 
>     # after 'use Module::Pluggable'
> 
>     # only needs to be done once, so can remove from
>     # Jifty::ClassLoader/Util
>     use UNIVERSAL::require;
> 
>     {
>         no strict 'refs';
>         no warnings 'redefine';
>         *{'Module::Pluggable::Object::_require'} = sub {
>              my($self, $pack) = @_;
>              UNIVERSAL->require($pack);
>              return $@;
>         };
>     }
> 
> I don't like this very much because it feels Jengaish, so please comment
> if you have a better idea. It does work, anyhow.

I think that the correct fix would be for Module::Pluggable to DTRT in the first
place (i.e. it should call $self->SUPER::require() instead of CORE::require(),
so that exactly this situation would be handled), though that may not be
possible due to the twisty passages that M::P has to negotiate already.

Alternatively, we could simply subclass Module::Pluggable and override its
require() with the above sub().  This has the distinct advantage of not messing
with the namespaces directly (but it is the moral equivalent).

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Blvd
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747


More information about the jifty-devel mailing list