Re: Version parsing confused by sub version {}
# from Andreas J. Koenig # on Saturday 17 November 2007 01:54: A different and slightly less brute fix would probably be to say version::-new() like I do on all package names always everywhere because it's the only safe way to call a method on a package name that has no colons in it. Well, or any package whatsoever. $ perl -e 'use strict; use warnings; sub foo::bar () {this}; foo::bar-new' Can't locate object method new via package this --Eric -- If the above message is encrypted and you have lost your pgp key, please send a self-addressed, stamped lead box to the address below. --- http://scratchcomputing.com ---
Re: Version parsing confused by sub version {}
On Sat, 17 Nov 2007 02:10:40 -0800, Eric Wilhelm [EMAIL PROTECTED] said: # from Andreas J. Koenig # on Saturday 17 November 2007 01:54: A different and slightly less brute fix would probably be to say version::-new() like I do on all package names always everywhere because it's the only safe way to call a method on a package name that has no colons in it. Well, or any package whatsoever. $ perl -e 'use strict; use warnings; sub foo::bar () {this}; foo::bar-new' Can't locate object method new via package this Thanks::for::the::correction::) -- andreas
Re: Version parsing confused by sub version {}
Dear god that is evil. How the hell is doing that sort of stuff. Adam K On 17/11/2007, Michael G Schwern [EMAIL PROTECTED] wrote: 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
Version parsing confused by sub version {}
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