Data::Compare::Plugins::Set::Object - plugin for Data::Compare to handle Set::Object objects


version 1.002


    use 5.010;
    use Set::Object 'set';
    use Data::Compare;

    my $foo = {
        list => [ qw(one two three) ],
        set  => set( [1], [2], [3] ),
    my $bar = {
        list => [ qw(one two three) ],
        set  => set( [1], [2], [3] ),

    say 'Sets in $foo and $bar are ',
        $foo->{set} == $bar->{set} ? '' : 'NOT ', 'identical.';
    say 'Data within $foo and $bar are ',
        Compare($foo, $bar) ? '' : 'NOT ', 'equal.';


Enables Data::Compare to Do The Right Thing for Set::Object objects. Set::Object already has an equals() method, but it only returns true if objects within two sets are exactly equal (i.e. have the same references, referring to the same object instance). When using Data::Compare in conjunction with this plugin, objects in sets are considered the same if their contents are the same. This extends down to sets that contain arrays, hashes, or other objects supported by Data::Compare plugins.


As a plugin to Data::Compare, the interface is the same as Data::Compare itself: pass the reference to two data structures to the Compare function, which for historical reasons is exported by default.

Set::Object also can export certain functions, and overloads comparison operators pertaining to sets. Consult the Set::Object documentation for more information.



You can find documentation for this module with the perldoc command.

  perldoc Data::Compare::Plugins::Set::Object


The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Bugs / Feature Requests

Please report any bugs or feature requests through the web interface at You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

  git clone git://


Mark Gardner <>


This software is copyright (c) 2017 by Mark Gardner.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.