NAME
Articulate::Role::Sortation::AllYouNeedIsCmp - provides sortation methods derived from you cmp method
SYNOPSIS
package My::Sortation::Class;
use Moo;
with 'Articulate::Role::Sortation::AllYouNeedIsCmp';
sub cmp { ... }
sub decorate { ... } # optional
1;
Provides the sort
and schwartz
funtions. These call on the cmp
method (which you are exected to write) and, optionally, the decorate
method (if it exists).
METHODS
order
Convenience method which inspects the order
value of the options
hash and returns it (or returns asc
) if undefined).
sort
$sorter->sort( [items] )
Performs a simple sort, using cmp
and decorate
.
schwartz
$sorter->schwartz( [items] );
Performs a schwartxian transform using decorate
, and sorts the decorated items using cmp
, then returns the originals in the sorted order.