On 4/7/13 11:34 AM, belg4mit@pthbb.org via RT wrote:
Show quoted text> I used
>
> $VERSION = 2.19.1;
>
> in my module, MakeMaker extracted it and used it from there.
>
> $VERSION = '2.19.1';
>
> escapes this, but considering that the rest of the toolchain
> e.g; PAUSE, CPAN Testers, search.cpan.org; supports the former
Do you have examples of that? I didn't think they did.
Show quoted text> it does not seem unreasonable that MakeMaker should DWIM when
> creating a dist filename.
The issue is that the latter is the string '2.19.1'. MakeMaker and
CPAN::Meta (which MakeMaker uses to generate the meta files) can deal
with that.
The former is interpreted as a version string by Perl. $VERSION winds
up containing not the string "2.19.1" but three bytes which are 2, 19
and 1. There's no code in MakeMaker to contend with this.
To work around this, MakeMaker would have to determine if $VERSION is
using a version string or not. The basic heuristic is pretty easy,
check if the first byte is less than 48 (ASCII 0) and hope nobody
decides to release 49.49.49 (which is the string "111").
Patching this is fairly straight forward. The code to interpret
$VERSION is in lib/ExtUtils/MM_Unix.pm and the tests in
t/parse_version.t. Translating the version string into a regular string
should fix everything else down the line.
Have a crack at it.
Show quoted text> The documentation regarding this
>
> "Version strings" are incompatible should not be used.
>
> is quite brief and easy to overlook. Some explanation as to why,
> and what happens would be useful i.e;
>
> MakeMaker uses stringified version numbers when generating
> filenames, consequently v-strings such as C<$VERSION = 1.2.3>
> will result in filenames containing control characters due to
> perl's internal representation of v-strings.
>
> L<version> objects were added in Perl 5.10, and are
> recommended instead.
Agreed. The whole way versions are documented in ExtUtils::MakeMaker
needs to be overhauled. I would recommend taking the docs out of
VERSION_FROM and creating a new "=head2 Declaring Versions" section.
Show quoted text> Also, if MakeMaker won't DWIM with a v-string, what about
> throwing a warning to explain the mangled filename that results?
That would be good if parse_version isn't fixed.
Would you like to have a crack at this?