Mojolicious::Plugin::PromiseActions - Automatic async and error handling for Promises
plugin 'PromiseActions'; get '/' => sub { my $c=shift; app->ua->get_p('ifconfig.me/all.json')->then(sub { $c->render(text=>shift->res->json('/ip_addr')); }); };
Sets up a around_dispatch hook to disable automatic rendering and add a default catch callback to render an exception page when actions return a Mojo::Promise
Copyright (C) 2018, Marcus Ramberg.
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
https://github.com/kraih/mojo, Mojolicious::Guides, Mojo::Promise, Mojolicious::Plugin
To install Mojolicious::Plugin::PromiseActions, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::PromiseActions
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::PromiseActions
For more information on module installation, please visit the detailed CPAN module installation guide.