[Catalyst] how to reuse Catalyst Schema for non-web purposes?
Moritz Onken
onken at houseofdesign.de
Thu Apr 23 12:05:37 GMT 2009
>
>
> 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
More information about the Catalyst
mailing list