[dancer-users] Delayed template processing

Joerg Fallmann fall at tbi.univie.ac.at
Tue Oct 13 14:51:51 BST 2015


Hi Everyone,

What I'm looking for is a way to render a template with part of the
results to the user to see while I continue processing and when I'm done
I want to show the final template with all results. I'm currently using
the new delayed method, which works fine for strings,
but if I want to render templates it does not provide content until the
very end, so no in-between output is produced, as I would like to show.
Example code here:

|get '/test/:*?' => sub { my $id = params->{'id'}; my $blub =
params->{'blub'}; delayed { my $tt = Template->new( {INCLUDE_PATH =>
"$path", WRAPPER => 'layout.tt', RELATIVE => 1, }) || die "Template
error: $Template::ERROR\n"; $tt->process('view.tt', { 'id' => $id, 'bla'
=> $blub }; content $tt; ### Process further push my @more, "String"; my
$tt2 = Template->new( {INCLUDE_PATH => "$path", WRAPPER => 'layout.tt',
RELATIVE => 1, }) || die "Template error: $Template::ERROR\n";
$tt2->process('view.tt', { 'id' => $id, 'bla' => $blub, 'more' => \@more
}; content $tt2; done; }; }; |

Is this possible or am I completely on the wrong track?
Thanks,
Joerg

Phone: +43 1 4277 52732
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151013/f393ff7f/attachment.html>


More information about the dancer-users mailing list