3

Let say the public URL /faq is linked to the private path /faq/index in my Catalyst application:

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

How can I do a forward to /faq from another controller, that is how can I know that the action for the URL /faq is /faq/index ? Something like:

$c->forward(c->dispatcher->get_action_by_path( "/faq" )); # does not work
brian d foy
  • 129,424
  • 31
  • 207
  • 592
Julien
  • 5,729
  • 4
  • 37
  • 60

1 Answers1

2

I got the 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);
Julien
  • 5,729
  • 4
  • 37
  • 60