Simultaneous multiple module versions kane at
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
> almost
>    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
> to
>    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
> the
>    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
as following:
  * 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.
Distinguishing them
    at runtime will be troublesome.

Now, you can play tricks with stashnames etc, trying to alias and so on,
but implementation
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
ancient version
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
programmers to
fix it anyway.

Hope this helps,


More information about the mailing list