CC: | "List - Module-Build" <module-build [...] perl.org>, bug-Module-Build [...] rt.cpan.org |
Subject: | Re: Version parsing confused by sub version {} |
Date: | Sat, 17 Nov 2007 12:38:26 +1100 |
To: | "Michael G Schwern" <schwern [...] pobox.com> |
From: | "Adam Kennedy" <adamkennedybackup [...] gmail.com> |
Dear god that is evil.
How the hell is doing that sort of stuff.
Adam K
On 17/11/2007, Michael G Schwern <schwern@pobox.com> wrote:
Show quoted text
>
> A bug in MakeMaker's parse_version() was found recently. Module::Build
> has
> the same bug.
> https://rt.cpan.org/Ticket/Display.html?id=30747
>
> It's reproducible by getting the version from a module like this:
>
> $VERSION = 1.23; sub version { $VERSION }
>
> and then this:
>
> use version; $VERSION = version->new(2.34);
>
> The version() routine pollutes the namespace in which the $VERSION code is
> evaled. It thinks version->new() is version()->new() calling the
> polluting
> version() routine. MakeMaker fixed it by deleting any version() routines
> from
> the symbol table before trying to eval the $VERSION code.
>
> Here's code to reproduce:
>
> $ cat Version_Sub.pm
> package Version_Sub;
>
> $VERSION = 1.23; sub version { $VERSION }
>
> 1;
>
>
> $ cat Uses_version.pm
> package Uses_version.pm;
>
> use version; $VERSION = version->new(2.34);
>
> 1;
>
>
> $ perl -wle 'use aliased "Module::Build::ModuleInfo"; print
> ModuleInfo->new_from_file("Version_Sub.pm")->version; print
> ModuleInfo->new_from_file("Uses_version.pm")->version'
> 1.23
> Can't call method "new" without a package or object reference at (eval 10)
> line 8, <GEN1> line 3.
>
>
> --
> Insulting our readers is part of our business model.
> http://somethingpositive.net/sp07122005.shtml
>
>