Set::Object

Set::Object Perl module contains a set of objects and strings.
Download

Set::Object Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jean-Louis Leroy
  • Publisher web site:
  • http://search.cpan.org/~samv/Set-Object-1.24/lib/Set/Object.pm

Set::Object Tags


Set::Object Description

Set::Object Perl module contains a set of objects and strings. Set::Object Perl module contains a set of objects and strings.SYNOPSIS use Set::Object; my $set = set(); # or Set::Object->new() $set->insert(@thingies); $set->remove(@thingies); @items = @$set; # or $set->members; $union = $set1 + $set2; $intersection = $set1 * $set2; $difference = $set1 - $set2; $symmetric_difference = $set1 % $set2; print "set1 is a proper subset of set2" if $set1 < $set2; print "set1 is a subset of set2" if $set1 new(@stack); while (my $object = pop @stack) { if (reftype $object eq "HASH") { # do something with hash members # add the new nodes to the stack push @stack, grep { ref $_ && $seen->insert($_) } values %$object; } elsif (reftype $object eq "ARRAY") { # do something with array members # add the new nodes to the stack push @stack, grep { ref $_ && $seen->insert($_) } @$object; } elsif (reftype $object =~ /SCALAR|REF/) { push @stack, $$object if ref $$object && $seen->insert($$object); } }This modules implements a set of objects, that is, an unordered collection of objects without duplication.The term objects is applied loosely - for the sake of Set::Object, anything that is a reference is considered an object.Set::Object 1.09 and later includes support for inserting scalars (including the empty string, but excluding undef) as well as objects. This can be thought of as (and is currently implemented as) a degenerate hash that only has keys and no values. Unlike objects placed into a Set::Object, scalars that are inserted will be flattened into strings, so will lose any magic (eg, tie) or other special bits that they went in with; only strings come out.Requirements:· Perl Requirements: · Perl


Set::Object Related Software