On Wed, Feb 15, 2012 at 01:03:53PM -0600, Peter Karman wrote: > On 2/15/12 11:17 AM, David E. Wheeler wrote: > >> Some might find it a bit annoying, but it’s probably the safest way >> to manage Perl module versions. The second way to do it is lazier: >> Just put this line in every Perl module in a distribution: >> >> require Lucy; our $VERSION = eval $Lucy::VERSION; >> >> And yes, it has to be on one line so that Module::Build will parse >> out the one line and eval it. I think this would be safe, though I >> don’t know if you want to load Lucy.pm in every file. >> > > +1 to that idea. Lucy is mostly XS with pro forma .pm files so 'use > Lucy' is implicit in every Lucy::* class already.
It turns out that this technique has significant drawbacks. The main problem is that it's not safe to "require Lucy" or "use Lucy" before the XS extension is built, so the routine in Module::Build::ModuleInfo which extracts version numbers can't be run on Lucy before the build finishes. That was the root cause of this buildbot failure: http://ci.apache.org/builders/lucy-trunk-fbsd/builds/178 With this commit, I was able to made the immediate problem go away for some systems, e.g. the FreeBSD buildbot running Perl 5.12.4 and my local copy of Perl 5.10... http://svn.apache.org/viewvc?view=revision&revision=1294825 ... but other systems are still broken, e.g. my local copy of Perl 5.14.1. It is hard to guarantee that that ModuleInfo code will not be run too soon, as it seems that Module::Build assumes it will always be safe. Therefore, I think that if we are going to specify per-Perl-package version numbers, we have to go with explicit numbers. (My personal preference is to just require Module::Build 0.38 or above during "./Build dist", though.) Marvin Humphrey
