[Catalyst] how to reuse Catalyst Schema for non-web purposes?

kakimoto at tpg.com.au kakimoto at tpg.com.au
Fri Apr 24 04:08:14 GMT 2009


I took off the 'Authentication::Store::DBIC' from my "use Catalyst qw(" in myApp.pm.

This is such that " Catalyst/Plugin/Authentication/Store/DBIx/Class.pm" will not be required.
After all, no such thing exists(checked cpan).


Strangely, when I run scripts/myApp_server.pl, 
I got this message: 

------------------ error message - start ------------------------
[error] Caught exception in myApp::Controller::Root->auto "Can't call method "user_is_restorable" 
on an undefined value at /usr/local/lib/perl5/site_perl/5.8.9/Catalyst/Plugin/Authentication.pm line 
168."
------------------ error message - end ------------------------

 I found a thread which I think is fairly similar. It's http://www.mail-
archive.com/catalyst at lists.scsys.co.uk/msg04758.html. 
Going to give it a go and will share with you guys on my findings:)

K. akimoto



Quoting kakimoto at tpg.com.au:

> Gah.... Thanks, moritz.. 2am here and my coffee's runnin' low.
>  haha 
> that's the case i figure. I will give it a go tomorrow.
>  Cheers!
> 
> 
> Quoting Moritz Onken <onken at houseofdesign.de>:
> 
> > >
> > >
> > > So it's the model I put the business logic in?  That sounds ok,
> for
> >  
> > > now.  But what about this:
> > > * Input from the web has to be validated.  May be I use  
> > > Data::FormValidator, may be FormFu.  However, I may have to
> > validate  
> > > the params I get from the script (eg. data import from ERP
> > systems),  
> > > too.  Do I have to implement the validation again?  And maybe  
> > > normalization/converting, too?  Or where would you place these  
> > > functionality?  Extra modules?
> > 
> > You are not limited by the number of models. You can write a model 
> 
> > which does the form/data validation and which calls the dbic model
> to
> >  
> > insert the data. Just place an extra layer between your controller
> > and  
> > your dbic model.
> > 
> > > * What about business logic that is in not only bound to a
> specific
> >  
> > > schema but has an overall logic that fetches data from different 
> 
> > > tables, adds some somewhere and produces results?  How would you 
> 
> > > implement such a logic?  Any examples?
> > 
> > I would write an extra model for this or you create a resultset
> class
> >  
> > which can handle that. This very much depends on the data which is 
> 
> > needed.
> > 
> > > * An example for using data and logic outside of the web app
> would 
> > 
> > > be generating invoices by night.  That process would bring out
> some
> >  
> > > PDFs which will be printed or sent by mail through another
> script. 
> >  
> > > Shouldn't a view be involved in this process that builds the PDFs
> 
> > 
> > > from templates?  Is it possible to build this example upon a  
> > > Catalyst web app?  Examples?
> > 
> > I use Template::Plugin::Latex to create a TeX document which is
> then 
> > 
> > converted to a pdf. But this is totally independent from catalyst.
> It
> >  
> > is a script which is run once a day and generates the invoices. No 
> 
> > need to follow the MVC scheme here.
> > 
> > If you plan to run those jobs with catalyst I'll suggest you have a
> 
> > 
> > look a job queue which can help you with that (e.g. TheSchwartz).
> > 
> > 
> > moritz
> > 
> > _______________________________________________
> > 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/
> > 
> > 
> > 
> 
> 
> 
> 
> _______________________________________________
> 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/
> 
> 
> 







More information about the Catalyst mailing list