Subject: | intersection+refs |
I have found a bug in Set::Scalar 1.23. The intersection method does not like references in the
set. The attached patch fixes it. I hope you find this helpful.
Subject: | open_g7iivwvc.txt |
Binary files Set-Scalar-1.23-ZFAhUj/.DS_Store and Set-Scalar-1.23-ZFAhUj copy/.DS_Store differ
diff -Nurp Set-Scalar-1.23-ZFAhUj/lib/Set/Scalar/Base.pm Set-Scalar-1.23-ZFAhUj copy/lib/Set/Scalar/Base.pm
--- Set-Scalar-1.23-ZFAhUj/lib/Set/Scalar/Base.pm 2009-01-16 18:44:51.000000000 -0800
+++ Set-Scalar-1.23-ZFAhUj copy/lib/Set/Scalar/Base.pm 2009-05-14 21:24:00.000000000 -0700
@@ -306,7 +306,7 @@ sub _intersection ($$) {
my %intersection = _make_elements $intersection->elements;
- delete @intersection{ $that->elements };
+ delete @intersection{ keys %{{ _make_elements $that->elements }} };
$intersection->delete( values %intersection );
diff -Nurp Set-Scalar-1.23-ZFAhUj/t/intersection.t Set-Scalar-1.23-ZFAhUj copy/t/intersection.t
--- Set-Scalar-1.23-ZFAhUj/t/intersection.t 2005-08-06 02:34:46.000000000 -0700
+++ Set-Scalar-1.23-ZFAhUj copy/t/intersection.t 2009-05-14 21:24:37.000000000 -0700
@@ -1,6 +1,6 @@
use Set::Scalar;
-print "1..23\n";
+print "1..24\n";
my $a = Set::Scalar->new("a".."e");
my $b = Set::Scalar->new("c".."g");
@@ -95,6 +95,12 @@ print "ok 20\n";
print "ok 23\n";
}
+print "not " unless join("", sort @{
+ new Set::Scalar \$1,\$2,\$3,->intersection(
+ new Set::Scalar \$2,\$3,\$4
+ )
+}) eq join "", sort \$2,\$3;
+print "ok 24\n";