Data-CircularList

 view release on metacpan or  search on metacpan

lib/Data/CircularList.pm  view on Meta::CPAN

    # you have to write sort logic in compare_to method.
    package Person;

    sub new {
        my $class = shift;
        my %args = @_;
        my $self = {
            name => $args{'name'},
            length => length($args{'name'}),
        };
        bless $self => $class;
        $self->length(length($args{'name'}));
        return $self;
    }

    # sort by length of name, and name
    sub compare_to {
        my $self = shift;
        my $cell = shift;

        if ($self->length > $cell->length) {

t/02-etercase.t  view on Meta::CPAN


package Person;

sub new {
    my $class = shift;
    my %args = @_;
    my $self = {
        name => $args{'name'},
        length => length($args{'name'}),
    };
    bless $self => $class;
    $self->length(length($args{'name'}));
    return $self;
}

# sort by name's length
sub compare_to {
    my $self = shift;
    my $cell = shift;

    if ($self->length > $cell->length) {

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.892 second using v1.00-cache-2.02-grep-82fe00e-cpan-503542c4f10 )