in reply to Re: How can I (safely) use packages of the same name but different versions?
in thread How can I (safely) use packages of the same name but different versions?

I'm sorry I forgot to mention that ALL function calls go through this universal autoloader, and if the function can not be found in the symbol table it figures out the package name with a regular expression, requires the package, and then calls the function:
# figure out package name as $pkg eval "require $pkg;";
The real problem is similar to a dynamic plugin system, but I do not want the residual effects of loading a package (permanently modifying the symbol table) that exists elsewhere.
  • Comment on Re^2: How can I (safely) use packages of the same name but different versions?
  • Download Code

Replies are listed 'Best First'.
Re^3: How can I (safely) use packages of the same name but different versions?
by samtregar (Abbot) on Mar 11, 2008 at 21:24 UTC

    The real problem is similar to a dynamic plugin system, but I do not want the residual effects of loading a package (permanently modifying the symbol table) that exists elsewhere.

    How do you intend to avoid permanently modifying the symbol table? Why would you want that, anyway? If you don't permanently modify the symbol table won't you have to reload the entire module on each function call?

    -sam
      That's why I'm asking - I'm not sure how I intend to do it :)

      I want to do this because I do not want older code (read: default install location) to be calling functions in a newer codebase just because something called a function in the new codebase (and thereby required the new modules, replacing the symbols that existed).

      I.e.
      My::Package::foo(); ... NEW::My::Package::foo(); ... My::Package::foo(); # this one I want to use the old codebase always, + even if someone called the NEW:: version at some point.
        And I'm asking why you want that! If I upload v10 of My::Awesome::Module shouldn't all code switch to calling v10 instead of v9? If v10 fixes a critical bug or adds a new feature I'm pretty sure that's what I'd want.

        Put another way, if the new My::Package::foo() isn't supposed to replace the old My::Package::foo() why do they have the same names? My not call it My::OtherPackage::foo()?

        Another thought - are you trying to do development on a live server without affecting the production code?

        -sam