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

Brandon Black blblack at gmail.com
Fri Jul 13 12:42:51 GMT 2007


On 7/12/07, Ronald J Kimball <rkimball+catalyst at pangeamedia.com> wrote:
> I need to write a utility script using Controller modules that will run
> from the command line.  I haven't been able to find any examples of how
> to do this.  Does anyone have a quick example I could use as inspiration?
>

Probably the easiest way to invoke controller code from the
commandline would be to use wget against your server.  However,
wanting to invoke controller code from the commandline is a bad design
smell usually.  Domain logic should be packaged up independently in
your Model layer (in something Catalyst-agnostic, which your Catalyst
"Model" class encapsulates thinly).

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".

-- Brandon



More information about the Catalyst mailing list