[Catalyst] Command-line utility using Controller - examples?

Bill Moseley moseley at hank.org
Fri Jul 13 14:49:52 GMT 2007


On Fri, Jul 13, 2007 at 06:42:51AM -0500, Brandon Black wrote:
> The View should handle everything specific to HTML rendering, and the
> Controller should really be a very thin translation layer that maps
> HTTP inputs into View updates and Model calls.  In a design laid out
> like that, your question would become "How do I write a utility script
> that will invoke some of my Model code", and the answer would be "use
> your non-Catalyst underlying Model class directly from the script and
> call whatever you need to call".

In some cases it's handy for the application to handle these tasks.  I
suspect that's one reason C::P::Scheduler is around.   One case might
be sending emails triggered by a cron job that include a self
referencing url back to the application.

Note, I said handy, not required.  Probably better to write out a base
URL when the app starts and then have the cron job use that.  But, the
infrastructure that Catalyst provides can make doing this in the
application tempting.  It's up to you if you want to give up those
request cycles to other things than web requests.

-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list