On Fri, 2 Feb 2001, Garrett Goebel wrote:

> $Foo::VERSION eq 1.00 
>  |    
>  |  $Foo::VERSION eq 2.00
>  |   |
> Bar Baz
>   \ /
> My::Module

        Ideally, it should be perfectly legit to have multiple versions of
a given module on your system, which would resolve this problem nicely.

        One possible implementation for that would be to introduce a new
special token, __VERSION__.  It would work something like this:

package Bar::Quux;
__VERSION__ 2.0

...stuff...

__VERSION__ 1.3

...stuff...

__VERSION__ 1.0

...stuff...

We then change the semantics of use slightly, so it becomes:

use Bar::Quux;         # Identical to current; nothing breaks; loads the
                       #    code in the first VERSION, then stops parsing
use Bar::Quux 1.3;     # Parses the file looking for __VERSION 1.3__,
                       #    ignores everything except that version

When you want to install a new version, you simply prepend it with its
version number (or insert it at appropriate place).

The order is, of course, irrelevant...you can order it as 1.3, 2.0, 1.0 if
you want, but then 1.3 would be loaded by default and you would need to
explicitly request other versions.

I'm sure this idea can be improved on, but it's a first cut.  What do
people think?


Dave

Reply via email to