Simultaneous multiple module versions
kane at xs4all.nl
Wed Aug 16 18:39:53 BST 2006
> I'd like to have multiple versions of the same modules installed, and used
> selectively by different mod_perl apps on the same apache daemon...
> Options I've thought of so far:
> a) Run multiple versions of the Perl interpreter within mod_perl (and
> double the memory footprint of apache..)
> (Or run multiple instances of apache with different @INC setup)
> b) rename the old modules to Ancient::whatever and %s///g for references
> them in the old app.
> c) Give up on porting the app, and just shift disk images of the old RH7
> machines onto vmware machines running on new hardware and try to get
> re-write priority raised.
> d) Start drinking heavily.
d) is always a good basis, but to solve your problem more permanently,
here's a bit
of insight that might prove valuable: there's no way currently in perl to
load 2 versions
of 1 module within the same interpreter without clashes. The reasons are
* they have the same name, ergo the same entry in %INC
- so you have to trick %INC to let you load a module again
* they have the same namespace, so they'll possible overwrite
- so you have to seperate the namespaces
* this only lets you use load 2 versions at the same time.
at runtime will be troublesome.
Now, you can play tricks with stashnames etc, trying to alias and so on,
wise a) or b) will actually give you the result you want, without
brreaking the way perl thinks
about namespaces, files etc.
As you're speaking of porting an ancient app, it might also want a more
of the perl interpreter (plus core modules of that moment), so perhaps a)
is your best bet.
Remember, throwing extra hardware at it is usually cheaper than paying
fix it anyway.
Hope this helps,
More information about the london.pm