-
-
Save anonymous/83be5a75d1a24c622915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Testapp; | |
use Mojo::Base 'Mojolicious'; | |
sub startup { | |
my $app = shift; | |
$app->routes->get('/')->to('example#foo'); | |
} | |
package Testapp::Example; | |
use Mojo::Base 'Mojolicious::Controller'; | |
sub foo { | |
my $self = shift; | |
$self->stash( col => [qw(abc def ghi)] ); | |
$self->respond_to( | |
html => sub { $self->render( inline => '<%= shift @$col %>' ) }, | |
json => { | |
json => { | |
blah => $self->render_to_string( inline => '<%= shift @$col %>' ), | |
}, | |
}, | |
); | |
} | |
Mojolicious::Commands->start_app('Testapp'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment