in reply to variable "inheritance"; viral $VERSION

Unfortunally, CPAN doesn't know how to deal with that. It looks for lines that assign, or appear to assign to a variable $VERSION. If you are inheriting $VERSION, CPAN will think the module doesn't have a version.

Whether that's going to be a problem for you or not, I do not know.

Abigail

Replies are listed 'Best First'.
Re: Re: variable "inheritance"; viral $VERSION
by amackey (Beadle) on Mar 09, 2003 at 04:31 UTC
    Right, except that all of these classes get packaged together in the same CPAN module (hence the My::Package nomenclature). My understanding is that Makefile.PL's VERSION_FROM does actually compile a module, and read its $VERSION variable. Does it really only parse the file, not compile it?
      CPAN does track the VERSION of each .pm file, and it will not install a .pm file if it thinks the one already installed is newer, regardless what the version number is of the package. (In fact, as far as I can tell, there's no relationship between the version of the package (the number in the tar file), and the versions of the .pm files).

      As far as CPAN is concerned, all the .pm files without a VERSION assignment in the file itself do not have a VERSION. It'll list them as undef. Whether it will then actually replace an already installed file with a newer one, I do not know. For me, CPAN usually doesn't do what I mean, so I wouldn't dare take the risk.

      Abigail

        Does CPAN track VERSION by compiling the file and checking for $package::VERSION, or does it do the same parsing as ExtUtils::MakeMaker's VERSION_FROM utility?

        What I'm trying to avoid is all the CPAN problems to which you allude: all the files in my package remain in lock step through every release (and reflect the version of the overall distribution).

      The things in PREREQ are required and then $VERSION checked for. The version specified using VERSION_FROM is retrieved by parsing the file. From the ExtUtils::MakeMaker docs:

      Instead of specifying the VERSION in the Makefile.PL you can let MakeMaker parse a file to determine the version number. The parsing routine requires that the file named by VERSION_FROM contains one single line to compute the version number. The first line in the file that contains the regular expression

      /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/