Hi.
I revamped Mojolicious::Plugins::emit_chain to make it possible to re-
try
next->() again and again.
https://github.com/jamadam/mojo/commit/a71fe812e76e1cee2b6eb2e7b5184411ee545a07
The following is an example for multiple call of next->().
# Wrap whole application for redirecting 404 to /
hook around_dispatch => sub {
my ($next, $self) = @_;
# pre-processing here
$next->();
# post-processing here
if ($self->tx->res->code == 404) {
# Initialize everything (maybe this part must be more careful)
$self->{stash} = {};
$self->tx->res(Mojo::Message::Response->new);
$self->req->url->path('/');
$next->(-1); # seeking last one
}
};
I wish this for re-implementing my plugin
Mojolicious::Plugin::PlackMiddleware.
I don't know anyone except me uses this plugin, though.
There may be many way of hack to achieve this.
Do you think the patch above seems to be sensible?