I just read Joel's blog ( https://mojolicious.io/blog/2018/12/24/async-await-the-mojo-way/) about async/await support. This is wonderful. I am totally excited about this. Thank you to all involved!
Obviously I had to test this right away and it works great with the Mojolicious::Lite demo shown in the blog. But how do I specify a route to a async method in a controller for a Mojolicious app? Using a callback I can easily translate the Lite approach $r->get('/cb' => async sub ($c) { await Mojo::Promise->new(sub ($resolve,$fail) { Mojo::IOLoop->timer(3 => sub { $resolve->(); }); }); $c->render(text => 'hello'); }); but how do I use this when I want to have the code in a controller: $r->get('/ctr')->to('example#hello'); with package MyApp::Controller::Example; use Mojo::Base 'Mojolicious::Controller', -async, -signatures; async sub welcome ($self) { await Mojo::Promise->new(sub ($resolve,$fail) { Mojo::IOLoop->timer(3 => sub { $resolve->(); }); }); $self->render(text => 'hello'); } does not work as expected as the router does not seem to expect the methods to be async when called like that. -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/519ec59d-cb9d-46c6-9a6a-970a2f3142b6%40googlegroups.com.