From: Marius Gavrilescu Date: Sun, 29 Mar 2015 09:49:25 +0000 (+0300) Subject: Order JSON song list by title (same order as HTML table) X-Git-Tag: 0.005~6 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=6dcbbf44de50d95be5ba8f1e3416c1c1ade96f04;p=app-musicexpo.git Order JSON song list by title (same order as HTML table) --- 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; }