Skip Menu |

This queue is for tickets about the Set-Scalar CPAN distribution.

Report information
The Basics
Id: 5829
Status: resolved
Priority: 0/
Queue: Set-Scalar

People
Owner: Nobody in particular
Requestors: lucir [...] ok.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.18
Fixed in: (no value)



Subject: Minor error in function is_disjoint
Hello Jarkko, I've found a tricky bug in Set::Scalar, function is_disjoint. The bug takes effect only under specific conditions: when is_disjoint() is called in list context, and the compare result is 'disjoint' (not 'disjoint universes'), function return list consisting of a single undef element. While this may be easily avoided by not callinng the function in list context, sometimes list context is more convenient. Code example is: my $set1 = Set::Scalar->new( qw( a b)); my $set2 = Set::Scalar->new( qw( c d)); my ( $should_be_true_1, $should_be_true_2) = ( $set1 -> is_disjoint( $set2), 1); print $should_be_true_1 ? 'OK' : 'ERROR',"\n"; Suggested patch 'Base.pm.patch' is: *** Base.pm.orig Sat Oct 04 18:46:42 2003 --- Base.pm Sun Mar 28 18:27:05 2004 *************** *** 494,501 **** sub is_disjoint { my $a = shift; my $b = shift; ! ! return $a->compare($b) =~ /^disjoint( universes)?$/; } sub is_equal { --- 494,500 ---- sub is_disjoint { my $a = shift; my $b = shift; ! return scalar($a->compare($b) =~ /^disjoint( universes)?$/); } sub is_equal { Sincerelely, Alexei. P.S. My environment is: MS Windows XP, Perl 5.8.0. (Yet the environment seem to be insignificant).
Date: Sun, 28 Mar 2004 18:38:47 +0300
From: Jarkko Hietaniemi <jhi [...] iki.fi>
To: bug-Set-Scalar [...] rt.cpan.org
CC: rt [...] cpan.org
Subject: Re: [cpan #5829] Minor error in function is_disjoint
RT-Send-Cc:
Thanks for the bug report. I chose to fix the bug a bit differently, but in any case I just uploaded Set::Scalar 1.19. -- Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special biologist word we use for 'stable'. It is 'dead'." -- Jack Cohen