NAME
App::WRT::Sort - functions for sorting wrt entry lists
SYNOPSIS
use App::WRT::Sort qw(sort_entries);
my (@sorted) = sort_entries(@unsorted);
DESCRIPTION
This makes an effort to sort a list of entries, which may include both simple dates and names, or a combination thereof, reasonably.
The main goal is to have dates sorted in order, followed by alphanumeric names.
FUNCTIONS
- sort_entries(@entries)
-
Sort a list of entries by converting them to an array with an easily sortable string format as the second value, sorting these arrayrefs by that value, and then re-mapping them to the original values.
See here: https://en.wikipedia.org/wiki/Schwartzian_transform
- sortable_from_entry($entry)
-
Get a sortable string value that does (more or less) what we want.
In this case, it pads numeric components of the path out to 5 leading 0s and leaves everything else alone.