Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Use Moose in Controller and Model

by thunders (Priest)
on Jan 25, 2010 at 04:59 UTC ( #819395=note: print w/ replies, xml ) Need Help??


in reply to Use Moose in Controller and Model

I think the problems you are experiencing stem from not inheriting from Moose::Object. You can warn out the values in @ISA for the three different samples to verify.

From the Moose documentation:

extends (@superclasses)

This function will set the superclass(es) for the current class.

This approach is recommended instead of use base, because use base actually pushes onto the class's @ISA, whereas extends will replace it. This is important to ensure that classes which do not have superclasses still properly inherit from Moose::Object.


Comment on Re: Use Moose in Controller and Model
Re^2: Use Moose in Controller and Model
by sman (Beadle) on Jan 25, 2010 at 20:04 UTC
    Thanks. This is a test I did. I am not sure if I am right or wrong but I guess in the second case the superclass of Item becomes Moose::Object, not Catalyst::Controller::FormBuilder, and that's why Catalyst is complaining about. Am I right?
    [1] use Moose; BEGIN { extends 'Catalyst::Model::DBIC::Schema' }; print "$_\n", foreach @MyApp::Controller::Item::ISA; <result> Catalyst::Controller::FormBuilder [2] use Moose; use base qw/Catalyst::Controller::FormBuilder/; print "$_\n", foreach @MyApp::Controller::Item::ISA; <result> Moose::Object Catalyst::Controller::FormBuilder

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://819395]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (15)
As of 2014-09-16 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (38 votes), past polls