RSS | Module Info | Add a review of Set-Array
Set-Array (0.26)
I'm the maintainer, not the author, of this package.
This review is to warn you of unexpected and dangerous behaviour of some methods in Set::Array. Consider this code:
#!/usr/bin/env perl
use strict;
use warnings;
use Set::Array;
# -----------------
my($a1) = Set::Array -> new(qw(a b c d e) );
my($a2) = Set::Array -> new(qw( c d e f g) );
print "Before: ", join(' ', sort $a1 -> print), "\n";
my $difference = $a1 -> difference($a2); # Overload $a1 - $a2 has the same effect.
print "After: ", join(' ', sort $a1 -> print), "\n";
Even though $a1 is the invocant in the call to difference(), the value of the $a1 set is changed by this code. The output is:
Before: a b c d e
After: a b
I believe this to be a terrible design defect in the code, and recommend you use Set::Tiny instead.
My review of various array/set handling module is at:
savage.net.au/Perl-modules/html/setop...
Ron Savage - 2012-05-27T18:16:46 (permalink)
0 out of 2 found this review helpful.
Was this review helpful to you?
Yes
No

