Re: [Module::Build] version.pm and version number comparison problem
Status: Beta
Brought to you by:
kwilliams
|
From: Chris D. <ch...@cl...> - 2006-02-03 04:45:21
|
On Feb 2, 2006, at 10:17 PM, Ken Williams wrote:
> On Feb 2, 2006, at 10:22 AM, Chris Dolan wrote:
>
>> While we're at it, we should change the
>> UNIVERSAL::isa( $result, 'version' )
>> to
>> eval { $result->isa('version') }
>
> BTW, I actually tried this, and it broke the t/xs.t tests. I'll
> leave the reason why as an interesting exercise for the reader. =)
>
> -Ken
[SPOILER BELOW!]
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
It's a false failure. t/xs.t is calling dispatch() and testing $@ to
see if they fail. The die() triggered by isa() inside the eval sets
$@, and the test fails because $@ is set. However, this is because t/
xs.t mistakenly omits wrapping some of the calls to dispatch() in
their own eval{}. The following test (#2 of 22) passes in xs.t:
eval {$mb->dispatch('build')};
is $@, '';
but this test (#20 of 22) erroneously fails:
$mb->dispatch('build');
is $@, '';
So the test is checking $@ from the wrong eval.
The moral of the story is that using best practices help you find
bugs in code. ;-)
Chris
--
Chris Dolan, Software Developer, Clotho Advanced Media Inc.
608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703
vCard: http://www.chrisdolan.net/ChrisDolan.vcf
Clotho Advanced Media, Inc. - Creators of MediaLandscape Software
(http://www.media-landscape.com/) and partners in the revolutionary
Croquet project (http://www.opencroquet.org/)
|