Test::Proto::Compare - wrapper for comparison functions
my $c = Test::Proto::Compare->new(sub {lc $_[0] cmp lc $_[1]}); $c->summary('lc cmp'); $c->compare($left, $right); # lc $left cmp $right $c->reverse->compare($left, $right); # lc $right cmp lc $left
This class provides a wrapper for comparison functions so they can be identified by formatters.
If an argument is passed, it replaces the code attribute.
code
Chainable attribute containing the comparison code itself.
Executes the comparison code, using reversed to determine whether to reverse the arguments.
Chainable attribute; a brief human-readable description of the operation which will be performed. Default is 'cmp'.
Chainable attribute. 1 if the comparison is reversed, 0 otherwise. Default is 0. Also a chainable setter.
A chainable method which takes no arguments, and causes reversed to be either 1 or 0 (whichever it previously wasn't).
reversed
These run compare and return a true or false value depending on what compare returned.
To install Test::Proto, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Proto
CPAN shell
perl -MCPAN -e shell install Test::Proto
For more information on module installation, please visit the detailed CPAN module installation guide.