From 6dcbbf44de50d95be5ba8f1e3416c1c1ade96f04 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 29 Mar 2015 12:49:25 +0300 Subject: [PATCH] Order JSON song list by title (same order as HTML table) --- lib/App/MusicExpo.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/App/MusicExpo.pm b/lib/App/MusicExpo.pm index 96f9d8d..dd3e575 100644 --- a/lib/App/MusicExpo.pm +++ b/lib/App/MusicExpo.pm @@ -163,10 +163,11 @@ sub run { push @files, \%entry } + @files = sort { $a->{title} cmp $b->{title} } @files; my $json = JSON::MaybeXS->new(canonical => 1)->encode({files => \@files, prefix => $prefix}); $json =~ s//>/g; - $ht->param(files=>[sort { $a->{title} cmp $b->{title} } @files], prefix => $prefix, json => $json); + $ht->param(files => \@files, prefix => $prefix, json => $json); print $ht->output; } -- 2.30.2