On 12 April 2011 00:50, Charlie Garrison <[email protected]> wrote:

> Good morning,
>
> On 11/04/11 at 6:58 PM +0300, Octavian Rasnita <[email protected]> wrote:
>
>  The TT templates used by the Catalyst app might contain many things
>> like c.user, c.uri_for_action, may display images, may depend on other
>> templates which are loaded automaticly when those templates are
>> specified in the app config file. So there is no sane way of using
>> those wrapper templates for sending email from a cron job.
>>
>
> That was the conclusion I was reaching; I wanted feedback from others
> before I tried to make my own garden path.
>

Put the logic in a model class that reads a config shared with but
independent from your controller so you can run it outside of Catalyst.
This article outlines how to do this
http://www.catalystframework.org/calendar/2007/14
If you need any web transaction details (c.user etc.) capture them at
request time and put them in an item in a queue (using ActiveMQ or similar).
Then in your cron script step through the queue entries, unpack the details
and do the template merge using TT2 before sending using Mail::Sender or
Email::Stuff or whatever.
You don't really need the Catalyst controller framework up and running to do
that.

Regards, Peter
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to