[Catalyst] Sending email from Catalyst and scripts

Dave Rolsky autarch at urth.org
Wed May 23 16:23:04 GMT 2007


On Wed, 23 May 2007, Ash Berlin wrote:

> mark wrote:
>> Exactly; sending the email in end() after the page has been sent off would
>> not delay the page loading...
>> 
>> Mark
>> 
>
> Except that end is before the page has been sent back to the browser.
>
> You would need some kind of hook in what ever engine you are using to support 
> that. Not a bad idea mind, but I dont think anything exists currently.

You can do this sort of thing with mod_perl via $r->register_cleanup() 
(mp1). I'm sure there's a similar mp2 API, but I can't recall what it is.

The cleanup phase in mod_perl runs after output is sent to the client. 
Providing something similar for other Catalyst engines would be pretty 
cool.

Of course, if you're sending lots and lots of email, you're better off 
with an external queue, maybe processed via a daemon or cron. You don't 
want to tie up "expensive" app server processes sending email when they 
could be serving the next client.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/



More information about the Catalyst mailing list