Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 54945
Status: open
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: andyb [...] operamail.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.3603
Fixed in: (no value)



Subject: our SVERSION
Hi, We use Test::Perl::Critic extensively to maintain our code standards. Within this, $VERSION should be a constant, using Readonly. However, when I try to run Build.PL using Module::Build 0.3603, I get the following on modules that are required in Build.PL. (I am running perl 5.10.1 on MacOSXLeopard) Error evaling version line 'BEGIN { q# Hide from _packages_inside() #; package Module::Build::ModuleInfo::_version::p8; use Module::Build::Version; no strict; local $VERSION; $VERSION=undef; $vsub = sub { Readonly::Scalar our $VERSION => do { my ($r) = q$LastChangedRevision: 8212 $ =~ /(\d+)/mxs; $r; };; $VERSION }; }' in /Users/ajb/dev/new-pipeline-dev/useful_modules/branches/current/lib/npg_common/roles/log.pm: syntax error at (eval 31) line 9, near "Readonly::Scalar our " BEGIN not safe after errors--compilation aborted at (eval 31) line 11, <GEN7> line 19. failed to build version sub for /Users/ajb/dev/new-pipeline-dev/useful_modules/branches/current/lib/npg_common/roles/log.pm at /Users/ajb/dev/perl/5.10.1/lib/5.10.1/Module/Build/ModuleInfo.pm line 332, <GEN7> line 19. Couldn't run Build.PL: No such file or directory at /Users/ajb/dev/perl/5.10.1/lib/5.10.1/Module/Build/Compat.pm line 335. and a similar issue if my modules in the package also use Readonly::Scalar our SVERSION => 0.1; I don't know if others would have a similar problem, but is is not helpful for us to have to go around PerlCritic standards. Thanks for providing a really useful package for distribution and deployment. I hope that you can help out here. Cheers Andy
Subject: Re: [rt.cpan.org #54945] our SVERSION
Date: Wed, 24 Feb 2010 11:44:34 -0500
To: bug-Module-Build [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Wed, Feb 24, 2010 at 11:33 AM, Andy Brown via RT <bug-Module-Build@rt.cpan.org> wrote: Show quoted text
> and a similar issue if my modules in the package also use > Readonly::Scalar our SVERSION => 0.1;
The $VERSION line is processed using eval in a separate package space so I suspect the problem is due to Readonly not being loaded. What happens if you do this: use Readonly; Readonly::Scalar our $VERSION => 0.1; You may want to add "Readonly" to your configure_requires as well. -- David
Hi David, Thanks for your response. I tried this and found that it works, but it throws an interesting issue. If the module is one from this package (i.e. not 'required' in Build.PL) then it carps the error, but still constructs the Build file, and things can progress. However, if the module is from another source (i.e. 'required' in Build.PL) then it croaks out, since it can't identify the version number. If this is in another package that we are writing (for example a 'common' package that this and other packages use) then we can correct these so they all work, but if it is something installed from CPAN, then we have a problem, since we would not be able to get around that modules version number (unless we change the installed version manually, both a maintenance headache, and often not possible unless we have root access). I have tried Module::Install, and with this, its solution is to carp the version eval error, but construct the Makefile anyway (obviously, this has it's own problems with maybe not being in sync with the required version), but we don't stop installation. I can see that this maybe a corner case issue (we may be the only people using Readonly::Scalar with $VERSION) but it would be good to either have an option to continue, or if it is possible to patch Module::Build to 'use Readonly;' As I said before, thanks for your answer, and for producing/maintaining this tool. Cheers Andy
One thing I was unaware of was that the CPAN (and therefore) toolchain standard is that the our $VERSION line should be 'eval'able for any module. Someone mentioned this, and that perhaps they should make Module::Install more robust to deal with it when not. We are making the move to put the Readonly::Scalar our $VERSION... on the use Readonly; line (since this seems to be a standard thing, even though the code looks cluttered). Perhaps I could change this bug to a request that the POD states that Build.PL will fail if the line our $VERSION is on is not 'eval'able in any pakage or required modules. This would then clarify this to plebs like me. Thanks again for your time and patience, both in producing this package, and listening to me. Andy
Subject: Re: [rt.cpan.org #54945] our SVERSION
Date: Fri, 26 Feb 2010 11:21:05 -0500
To: bug-Module-Build [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Fri, Feb 26, 2010 at 11:00 AM, Andy Brown via RT <bug-Module-Build@rt.cpan.org> wrote: Show quoted text
> One thing I was unaware of was that the CPAN (and therefore) toolchain > standard is that the our $VERSION line should be 'eval'able for any > module. Someone mentioned this, and that perhaps they should make > Module::Install more robust to deal with it when not.
It's sort of documented here: http://pause.perl.org/pause/query?ACTION=pause_04about#conventions But you're right that it could be better documented and perhaps the tools could be better in catching the error and explaining it. Let's leave the ticket open as is and someone will get to it when they wind up with spare tuits. -- David