Re: [Mojolicious] set full package name for controller in a route

2020-06-21 Thread Dan Book
You need to set it as the namespace for the route:
https://metacpan.org/pod/Mojolicious::Guides::Routing#Namespaces

-Dan

On Sun, Jun 21, 2020 at 12:35 PM Miguel Prz  wrote:

> I want to reuse a set of controllers of a different hierarchy (starting
> with MyOther) used by my application (MyApp::Controller). But when I set:
>
> $app->routes->get('/init/:id')->to(controller =>"MyOther::Controller",
> action=> 'init' );
>
> I get an error in run time: (...) Controller "MyApp::MyOther::Controller"
> does not exist
>
> I don't know how to avoid the automatic "MyApp::" prefix
>
> Thanks!
>
> --
> 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/2abe60b0-ca69-4f87-9c6d-5a9b22d7e1cdo%40googlegroups.com
> 
> .
>

-- 
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/CABMkAVV2VkCdHn2e5REqZ42kC4syKM2CsUjTUYPejSnqLDG%2Bqg%40mail.gmail.com.


[Mojolicious] set full package name for controller in a route

2020-06-21 Thread Miguel Prz
I want to reuse a set of controllers of a different hierarchy (starting 
with MyOther) used by my application (MyApp::Controller). But when I set:

$app->routes->get('/init/:id')->to(controller =>"MyOther::Controller", 
action=> 'init' );

I get an error in run time: (...) Controller "MyApp::MyOther::Controller" 
does not exist

I don't know how to avoid the automatic "MyApp::" prefix

Thanks!

-- 
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/2abe60b0-ca69-4f87-9c6d-5a9b22d7e1cdo%40googlegroups.com.