Solstice

 view release on metacpan or  search on metacpan

lib/Solstice/List.pm  view on Meta::CPAN

    my ($self, $sort_ref) = @_;

    my @new_data;

    if (defined $sort_ref) {
        # $a and $b are package variables, so we want to copy $a and $b 
        # into the namespace of the caller. Since we're doing this work 
        # for every sort call, we had to make a block based sort instead 
        # of a usersub sort, and so we had to explicitely call our sorting 
        # subroutine reference.  
        my $calling_package = (caller)[0];
        { 
            no strict 'refs'; ## no critic
            @new_data = CORE::sort { ${"${calling_package}::a"} = $a; ${"${calling_package}::b"} = $b; &$sort_ref($a, $b); } @{$self->{'_list'}->_getDataArray()};
        }
    }
    else {
        @new_data = CORE::sort @{$self->{'_list'}->_getDataArray()};
    }

    my $package = ref $self->{'_list'};



( run in 1.950 second using v1.01-cache-2.11-cpan-a3c8064c92c )