How can I send a public path to another Catalyst controller?

Let's say the public URL / faq is associated with the private path / faq / index in my Catalyst application:

package MyApp::Controller:FAQ;
sub index :Path {
[....]

How can I redirect / faq from another controller, here is how I can find out that the action for URL / faq is / faq / index? Sort of:

$c->forward(c->dispatcher->get_action_by_path( "/faq" )); # does not work
+3
source share
1 answer

I got an answer for the Catalyst mailing list:

my $path = "/" . join '/', @{$c->req->args};

$c->request->path($path);
$c->dispatcher->prepare_action($c);

$c->detach($c->action, $c->req->args);
+2
source

Source: https://habr.com/ru/post/1727079/


All Articles