Sub::IsEqual - determine if two arguments are equal
Version 0.03
This module provides a function called is_equal to determine if any two arbitrary arguments are the same. Equality is determined by definedness, structure, and string equality, so 1 and 1.0 will be considered inequal. For data structures, circular references will be detected.
Given 2 arguments, determine if they are equivalent using string equality and deep comparison. For large data structures, is_equal will attempt to walk the structure, comparing all key-value paris for hashes, checking the order in arrays, and following all references while checking for loops. Blessed objects must be the same value in memory, by default, but may define their own equivalence by overloading the eq operator. The only exception to all of this is undef, which is only equivalent to itself.
Examples:
is_equal(undef, undef); # => true
is_equal(undef, ''); # => false
is_equal(1, 1.0); # => false
is_equal("mom", "mom"); # => true
is_equal([qw{hello world}], [qw{hello world}]); # => true
is_equal({hello => 1}, {hello => 1}); # => true
Aaron Cohen, <aarondcohen at gmail.com>
This module was made possible by Shutterstock (@ShutterTech). Additional open source projects from Shutterstock can be found at code.shutterstock.com.
Please report any bugs or feature requests to bug-sub-isequal at rt.cpan.org
, or through
the web interface at https://github.com/aarondcohen/perl-sub-isequal/issues. I will
be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Sub::IsEqual
You can also look for information at:
-
Official GitHub Repo
-
GitHub's Issue Tracker (report bugs here)
-
CPAN Ratings
-
Official CPAN Page
Copyright 2013 Aaron Cohen.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.