Order JSON song list by title (same order as HTML table)
authorMarius Gavrilescu <marius@ieval.ro>
Sun, 29 Mar 2015 09:49:25 +0000 (12:49 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sun, 29 Mar 2015 09:49:25 +0000 (12:49 +0300)
lib/App/MusicExpo.pm

index 96f9d8dda75d7c7680e0b99469bcdc2e2bcec456..dd3e57565591620d7ab4ff9070e308618f3d1bf0 100644 (file)
@@ -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/</&lt;/g;
        $json =~ s/>/&gt;/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;
 }
 
This page took 0.011449 seconds and 4 git commands to generate.