In Mojolicious can I forward to another action?

Viewed 38

In a Mojolicious lite app I'd like to forward a route to another action after mangling the parameters and the stash. Right now I am solving this by redirecting like so;

get '/icon/map/:item/:color' => sub ($c) {
    my ($library, $path) = split /\//, $icon_mapping->{$c->stash('item')}, 2;
    # and this then redirects to the next route below...
    $c->redirect_to(join '/', '/icon', $c->stash('color'), $library, $path);
};

# the above route redirects to this:
get '/icon/:color/:library/*icon' => { controller => 'Icons', action => 'serve_marker_icon_embedded' };

and it works ok, though I'd like this all to happen under the hood, and not expose the redirected path.

Is that possible?

0 Answers
Related