Re: [Module::Build] Buglet: Creative use of $VERSION confuses M::B
Status: Beta
Brought to you by:
kwilliams
|
From: Johan V. <jvr...@sq...> - 2006-03-27 16:47:31
|
John Peacock <jpe...@ro...> writes:
> If that second section was reformatted to:
> ...
> it wouldn't match the regex and hence not issue the warning.
(Also responding to Nick's reply)
BIG DISCLAIMER: Don't shoot me, I'm only the messenger.
BIG DISCLAIMER: I'm not blaming M::B, the problem is much more
fundamental.
Fact of the matter is that Perl uses the value of $VERSION as it is
upon completion of the load, which implies that any method using
static parsing may lead to surprises.
package Foo;
$VERSION = 1;
$VERSION++;
if ( -s "/etc/passwd" == 2011 ) {
$VERSION *=2;
}
1;
This indeed is version 2 or 4, depending on your /etc/passwd.
Probably the best pseudo-solution to this pseudo-parsing problem is to
stop parsing after the first successful assignment, and put a remark
in the documentation.
-- Johan
|