FAQ

On 12/04/11 08:10, Charlie Garrison wrote:
Good morning,
On 11/04/11 at 9:20 PM +0930, Jon Schutz wrote:

That was my thought. Usage is essentially...

use strict;
use warnings;
use HTTP::Request;

BEGIN {
$ENV{CATALYST_ENGINE} = 'Embeddable';
}

require MyApp;
my $response;
MyApp->handle_request(HTTP::Request->new('GET',
'http://localhost/send/email'), \$response);
Thanks for clarifying. And other than not tying up a FastCGI process,
what is the advantage of that approach over just sending a request via
http?
Depends on your circumstances, and personally I'd probably take the
approach of divorcing the templates from the catalyst context and just
use TT outside of Catalyst. But potential advantages of the embedded
approach are:

* Not needing to expose private URLs - if the URL you need to hit to
generate the email is not supposed to be available to the outside world,
you can use a different configuration for the app controlled from the
cron job.
* Still works if your Apache/FastCGI happen to be not running, in the
midst of restarting, or in bad shape for whatever reason, so save a
range of error checking and recovery that you would otherwise have to do.
* Can send your emails from another machine even if you don't have an
app running there.

BTW, you can use whichever form of URL that you like in the embedded
request - all of these forms that I tried still work (though as Matthias
pointed out, may affect how URLs appears in your templated output):

http://my.domain.com/send/email
http:///send/email
/send/email

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 11 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 10, '11 at 1:10p
activeApr 12, '11 at 5:53a
posts11
users5
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2023 Grokbase