[Catalyst] Using path_to()

Tomas Doran bobtfish at bobtfish.net
Wed Apr 29 10:03:10 GMT 2009


Octavian Rasnita wrote:
> Can't locate object method "path_to" via package "MyApp::View::TT" at 
> D:/web/MyApp/scr
> ipt/../lib/MyApp/View/TT.pm line 7.
> 
> It works if I use MyApp->path_to() instead...
> 
> Generally, it would be also very helpful if we could find which methods 
> are offered by a certain $c object in a certain place. Is there a way 
> for doing this?

I think you're very confused here.

Each model, view and controller is its own package, and nothing to do 
with $c (which @ISA Catalyst), doesn't inherit from Catalyst etc.

Therefore calling methods which exist in code for Catalyst _will never_ 
work for anything which isn't the MyApp class, or $c (which is an 
instance of that class).

If you're confused about what inherits from what, then try the following 
code snippet:

use MRO::Compat;
warn(__PACKAGE__ . ' inherits from: ' . join(', ', @{ 
mro_get_linear_isa(__PACKAGE__) });

Which should help to clarify what inherits from what.

Cheers
t0m




More information about the Catalyst mailing list