in reply to Re: variable "inheritance"; viral $VERSION
in thread variable "inheritance"; viral $VERSION

You didn't read my original post carefully. I don't need to implement "I am 'Foo'", I can simply "use My::Package::Version" wherever I want it.

The classes in my package all have "My::Package::*" names, and I only want $VERSION to propagate through all of these packages, not any other. I want a simple way to keep $VERSION "synchronized" throughout all classes of my package, without having to type something in all of them.

  • Comment on Re: Re: variable "inheritance"; viral $VERSION

Replies are listed 'Best First'.
Re: Re: Re: variable "inheritance"; viral $VERSION
by Anonymous Monk on Mar 09, 2003 at 03:25 UTC
    I did read your original post.

    My suggestion adds typing. Yes. It also removes typing. You no longer need the "use Foo" line. You no longer need to declare your @ISA. The typing saved exceeds the typing added. I consider that reasonable if your intention is to save typing.

    Now can you explain why on Earth you would want this?

      > Now can you explain why on Earth you would want this?

      The original intent stems from the fact that My::Package::* classes contain hundreds of classes (i.e. .pm files). But 95% of these classes inherit from one or two base classes. I was merely interested in probing whether there was a solution by which I could alter the base classes, and have the desired effect in all subclasses, without altering 100+ files (although it would be trivial to add one or two lines to each, following every "package Foo" line).

        Perhaps we should back up and consider something else.

        What do you see the point of $VERSION as? I told you several back what I think it to be, and therefore why you would not want a module reporting a $VERSION that is information from another file. But it seems that you think of $VERSION differently and see this as being a useful thing to do.

        What is the purpose of $VERSION to you, and why is it useful for a file to report its $VERSION as being the $VERSION of a different file that could readily be changed by someone independently from it?