[Catalyst] Why is $c undefined?

Craig Chant craig at homeloanpartnership.com
Tue Oct 30 12:16:50 GMT 2012

Cool, thanks Ian.

I am trying to build my models based on functionality around the DBIC ethos, not quite as a direct model->table mapping as DBIC creates, but for example all functions that require access to the 'Users' table, will have a 'Users' model and all functionality regarding logins, logouts, user name and other stuff kept in that model.

Separating it all into the correct models with all the desired methods isn't easy and will take time to formulate, but even though I'm not using Catalysts ORM/CRUD, I am still trying to stick to an MVC paradigm!

I have a long way to go for sure!


-----Original Message-----
From: Ian Docherty [mailto:catalyst at iandocherty.com]
Sent: 30 October 2012 11:25
To: The elegant MVC web framework
Subject: Re: [Catalyst] Why is $c undefined?

On 30 October 2012 11:09, Craig Chant <craig at homeloanpartnership.com> wrote:
> Thanks Ian,
> The hierarchy is something that I am finding mind-blowing at the moment,    "$self->jqgrid->render($self," , you are calling methods jqgrid->render on $self, passing in $self, I'm sure it makes sense to you :-)
> One thing I would like clarification with if possible.
> Where do I put code that requires the use of more than one model?
> Do I create a separate model that acts as an interface between the other models?
> You see I have two SQL servers in opposite ends of the country and so I have a model built on Model::DBI that can access one server and another Model that can access the other, but I have functionality that needs data from both , do some calculations and output accordingly.
> I assume this does not go in the controller, but I create an interface model with the required methods and functionality that the controller uses?
Craig. Yes, try to keep it out of the Controller.

My opinion is, that if you have business logic that uses data from two SQL servers (each of which has it's own model) then this would be a model in it's own right. First think of this business logic outside of Catalyst, it might have accessors for each of the SQL instance objects. Create a BusinessModel for this logic. You might find that this then becomes the only Model that you need to access from Catalyst, and the SQL server objects are not directly called from Catalyst, but are subsumed by BusinessModel.

Then use Catalyst::Model::Adaptor with your BusinessModel giving Catalyst access to all of it's methods.

Kind Regards

List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
This Email and any attachments contain confidential information and is intended solely for the individual to whom it is addressed. If this Email has been misdirected, please notify the author as soon as possible. If you are not the intended recipient you must not disclose, distribute, copy, print or rely on any of the information contained, and all copies must be deleted immediately. Whilst we take reasonable steps to try to identify any software viruses, any attachments to this e-mail may nevertheless contain viruses, which our anti-virus software has failed to identify. You should therefore carry out your own anti-virus checks before opening any documents. HomeLoan Partnership will not accept any liability for damage caused by computer viruses emanating from any attachment or other document supplied with this e-mail. HomeLoan Partnership reserves the right to monitor and archive all e-mail communications through its network. No representative or employee of HomeLoan Partnership has the authority to enter into any contract on behalf of HomeLoan Partnership by email. HomeLoan Partnership is a trading name of H L Partnership Limited, registered in England and Wales with Registration Number 5011722. Registered office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by the Financial Services Authority.

More information about the Catalyst mailing list