NAME
Mojolicious::Plugin::RenderSteps - ASync controllers without the boilerplate
SYNOPSIS
# Mojolicious::Lite
plugin 'RenderSteps';
get '/foo' => sub {
my $self=shift;
$self->render_steps(sub {
my $delay=shift;
$self->ua->get('reddit.com/',$delay->begin);
}, sub {
my $delay=shift;
$self->stash(res=>shift);
});
};
DESCRIPTION
Mojolicious::Plugin::RenderSteps lets you run async callbacks easily. When you call render_steps, it will automatically call render_later, and create a Mojo::IOLoop::Delay object, pass it your steps, and set up automatic rendering and error handling. This makes async actions behave like sync ones.
render_steps also automatically calls wait if the ioloop isn't running, so steps will function under PSGI, for instance.
SEE ALSO
Mojolicious, Mojolicious::Guides, http://mojolicio.us.
LICENSE
This module is licensed under the same terms as Perl itself.
COPYRIGHT
Copyright 2014 Marcus Ramberg