[Catalyst] Can't locate method ??? via MyApp

Tomas Doran bobtfish at bobtfish.net
Tue Mar 3 09:50:36 GMT 2009


On 3 Mar 2009, at 09:40, Dermot wrote:

> Hi,
>
> Running prove over my t directoty is giving me errors:
>
> Error:  Can't locate object method "config" via package "MyApp" at
> lib/MyApp/Model/DB.pm line 7.

<snip>

> Can't locate object method "path_to" via package "MyApp" at
> lib/MyApp/View/TT.pm line 20.

<snip>

> Do I need to 'use MyApp'?

Yes.

> I am not sure why it's not searching back up
> the tree to find these method from Catalyst.

Loading a leaf node in your object graph does not imply loading all  
of its parent nodes.

Unless you do something which implicitly loads MyApp first, then  
these classes won't work. You'll be able to see this by using perl -c  
lib/MyApp/View/TT.pm, which will break.

Cheers
t0m




More information about the Catalyst mailing list