[Catalyst] Creating a thin Model
Jamie Neil
jamie at versado.net
Fri May 18 17:07:57 GMT 2007
Can anyone tell me the best way of wrapping a non catalyst perl module
in a Catalyst Model?
I'm trying to setup the following stack:
MyApp::Controller::Widget
MyApp::Model::Widget
MyApp::Logic::Widget
MyApp::Schema::DB
where MyApp::Model::Widget is based on Catalyst::Model, contains the
configuration information for MyApp::Logic::Widget, and makes the
methods in MyApp::Logic::Widget available in MyApp::Controller::Widget
as $c->Model('Widget')->mymethod(...);
MyApp::Schema::DB is a DBIC Schema which I want MyApp::Logic::Widget to
use for storage, but not just passed through to the Model in the same
way that Catalyst::Model::DBIC::Schema does.
There is obviously more than one way to do this from looking at all the
other models on CPAN, but is there some kind of best practice? Should I
use AUTOLOAD, ACCEPT_CONTEXT, COMPONENT, override new or something else?
I did see a very promising thread on this issue a few months ago, but
this question
(http://lists.scsys.co.uk/pipermail/dbix-class/2007-January/003289.html)
was never really answered. I've been going round and round in circles on
this for a couple of weeks now, so some pointers (or even better example
code) would be most welcome.
--
Jamie Neil <jamie at versado.net>
Versado I.T. Services Ltd. <http://versado.net/> +44 845 450 1254
More information about the Catalyst
mailing list