Am 21.10.2009 um 00:25 schrieb Steve Rippl:

Hi,

I'm using TT for my View templates, and I'm experimenting with
Template::Plugin::Latex for generating pdf reports. Now I'm generating
pdfs (which is nice!) but not redirecting to them at the end, so I
suspect I'm using the wrong approach.

I'm doing the exact same thing, but without creating a temporary file:

my $template = "[% TT LATEX STUFF %]";
my $t = Template::Alloy->new;
my $out;
$t->process(\$template, {stash => 'bar'}, \$out) || die $@;
my $output = IO::String->new($out);
my $string = $output->string_ref;
$c->response->content_type('application/pdf');
$c->response->content_length( length $$string );
$c->res->body($$string);

You can probably skip the IO::String object...

That's about it.

cheers,
moritz

_______________________________________________
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