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

2007-07-17 Thread Ronald J Kimball

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.


That's actually what I ended up doing, just loading the Schema classes 
directly and adding the bit of extra handling that I wanted from the 
Controller.  (The Controller in this case is probably not as thin as it 
should be. :)


thanks,
Ronald

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2007-07-13 Thread Bogdan Lucaciu
On Friday 13 July 2007 14:42:51 Brandon Black wrote:
 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).

Or, if you -really- -actually- need controller logic in an external script, 
please explain what are you actually trying to achieve and we can think of a 
nice solution :)

-- 
Bogdan Lucaciu
http://www.wiz.ro

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2007-07-13 Thread Brandon Black

On 7/12/07, Ronald J Kimball [EMAIL PROTECTED] 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

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2007-07-13 Thread Bill Moseley
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
[EMAIL PROTECTED]


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


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

2007-07-12 Thread Ronald J Kimball
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?


thanks!
Ronald

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/