Skip to content

Instantly share code, notes, and snippets.

@sgnix
Last active August 29, 2015 14:05
Show Gist options
  • Save sgnix/fa3c4e4efe356b2cf326 to your computer and use it in GitHub Desktop.
Save sgnix/fa3c4e4efe356b2cf326 to your computer and use it in GitHub Desktop.
get '/fortunes' => sub {
my $self = shift;
$sth1->execute();
my $fortunes = $sth1->fetchall_arrayref({});
push @$fortunes, { id => 0, message => 'Additional fortune added at request time.' };
$self->template( 'fortunes', { fortunes => [ sort { $a->{message} cmp $b->{message} } @$fortunes] } );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment