Sort::Key::DateTime - Perl extension for sorting objects by some DateTime key
use Sort::Key::DateTime qw(dtkeysort); my @sorted = dtkeysort { $_->date } @meetings;
Sort::Key::DateTime allows to sort objects by some (calculated) key of type DateTime.
returns the elements on @array sorted by the DateTime key calculated applying { CALC_DT_KEY } to them.
@array
{ CALC_DT_KEY }
Inside { CALC_DT_KEY }, the object is available as $_.
$_
NOTE: sorting order is undefined when floating and non floating DateTime keys are mixed.
sorted @array in descending order
sort an array of DateTime objects in ascending and descending order respectively.
Example:
my @sorted = dtsort @unsorted;
sort @array in place.
generates string sorting keys for DateTime objects
Sort::Key, Sort::Key::Maker, perl sort function docs.
DateTime module documentation and FAQ available from the DateTime project web site at http://datetime.perl.org/
Salvador Fandiño, <sfandino@yahoo.com<gt>
Copyright (C) 2005, 2010 by Salvador Fandiño
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
To install Sort::Key::DateTime, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sort::Key::DateTime
CPAN shell
perl -MCPAN -e shell install Sort::Key::DateTime
For more information on module installation, please visit the detailed CPAN module installation guide.