aboutsummaryrefslogtreecommitdiff
path: root/lib/WebCoso/TT.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WebCoso/TT.pm')
-rw-r--r--lib/WebCoso/TT.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/WebCoso/TT.pm b/lib/WebCoso/TT.pm
index 50b28a3..923877c 100644
--- a/lib/WebCoso/TT.pm
+++ b/lib/WebCoso/TT.pm
@@ -29,6 +29,18 @@ $Template::Stash::HASH_OPS->{nsortf}=sub {
}
};
+$Template::Stash::LIST_OPS->{sortf}=sub {
+ my ($array,$field)=@_;
+
+ return [ sort { lc $a->{$field} cmp lc $b->{$field} } @$array ];
+};
+
+$Template::Stash::LIST_OPS->{nsortf}=sub {
+ my ($array,$field)=@_;
+
+ return [ sort { $a->{$field} <=> $b->{$field} } @$array ];
+};
+
sub new {
my ($class,%opts)=@_;