sub sort_by_spec {
my ($self, $spec, $items) = @_;
- return $items if not defined $spec;
+ return [sort @$items] unless $spec;
my @order;
if (ref $spec eq 'ARRAY') {
@order = @$spec;
- }
- elsif (not ref $spec) {
- return $items unless length $spec;
+ } elsif (not ref $spec) {
@order = split /\s+/, $spec;
}