Compiling a package into a namespace

Jesse Vincent jesse at fsck.com
Fri Apr 11 20:01:43 BST 2008


On Apr 11, 2008, at 2:52 PM, Simon Wistow wrote:
> This is very possibly one of those "You're asking the wrong question"
> questions but what the hell.
>
> I have a mod_perl app and I want to load a package called 'foo'  
> defined
> in ~/simon/a/foo.pm. However I also want to load a package called  
> 'foo'
> defined in ~/simon/b/foo.pm


You could have a wrapper routine which localizes %INC, removes entries  
not within 'b' and alters @INC to look to 'b' first for the duration  
of the load of 'b'.
For extra points, you could drop this wrapper into a coderef that  
itself lives at the front of @INC.

However, you're doing it wrong and this will cause problems. (But I  
don't see what they are, once you sort out the bits above).

-j
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://london.pm.org/pipermail/london.pm/attachments/20080411/d98373bc/PGP.pgp


More information about the london.pm mailing list