Re: [Module::Build] Buglet: Creative use of $VERSION confuses M::B
Status: Beta
Brought to you by:
kwilliams
|
From: Randy W. S. <ml...@th...> - 2006-03-28 04:29:15
|
Ken Williams wrote: > > On Mar 27, 2006, at 10:47 AM, Johan Vromans wrote: > >> >> 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. > > I believe that's what we actually do now, in the latest beta versions. It is except for one location when a fully-qualified package name is used: $Foo::Bar::VERSION vs $VERSION I can fix that, or I can allow successive expressions involving the same VERSION. I already put together a patch for it. It would allow arbitrary expressions like $VERSION = '1.01'; $VERSION = $VERSION + 1; $VERSION += 2; - package Foo::Bar; $VERSION = '1.01'; package Foo; $VERSION = $Foo::Bar::VERSION; The last one is a side effect, and incomplete in that order matters. Even that could be fixed by delaying evaluation until the file is completely scanned. But how far to go? The warning in the original post was meant to catch problems like package Foo; $VERSION = '1.23'; package Blah; [...] package Foo; $VERSION = '2.34'; # re-opened package with differing version. (This was from a problem Andreas reported a few months back with POE that turned out to be an unintentional buglet in POE.) We can make such warnings optional, I guess. What I really need is to scan CPAN for other problems like this. See what each alternative produces. The patch I mentioned is attached for reference. It simplifies the main parsing routine a good bit, and add a good bit more flexibility. There is are two failures that exercise the bug mentioned above that I've intentionally left unresolved; in the original tests I had left a comment questioning whether the behavior was correct or not-it could be argued either way. [This message is intentionally rambling, with no point.] > It's worth noting, however, that we can fix M::B's parsing all we want, > and still there will be parsers on PAUSE and in MakeMaker that will barf > on the same input. So probably it would be helpful for someone (not > me!) to have a tool that authors could run when they build their > distributions, looking for typical constructions that tend to cause such > barfs. Module::Build::ModuleInfo can be used directly for this. It is completely stand-alone. At some point it could hopefully be merged with Module::Info. Randy. |