[dancer-users] Delayed template processing

Joerg Fallmann fall at tbi.univie.ac.at
Wed Oct 14 13:26:48 BST 2015

Dear John,

what I would like to do is to stay in one route,
display whatever information I already have,
so that the user can start reading output,
while I continue processing until I have everything I need
and update what the user can see with the final information.

So similar to what delayed does when I use strings as content,
with the difference that I would like to use templates filled with
the initial content and update that templates content once processing
is done.

So far I have a myhost/welcomepage where the user can select some stuff
and is then redirected to myhost/results. From the user input I can
quickly create some content, but some other content takes some time,
and I would like to show what I have fast at myhost/results and update
myhost/results when the rest is done without redirecting to yet another 
instead of computing everything and then /push/ it to the user after 

@Amelia, I was playing around with delayed, and for me it works as expected
when I only want to return simple stuff like in the manual, but when I 
try to
use templates as content nothing happens until the very end of the route,
so just the final output is created and no in-between output.

Hope what I want to do is possible with Dancer2


On 10/14/2015 01:00 PM, dancer-users-request at dancer.pm wrote:
> Send dancer-users mailing list submissions to
> 	dancer-users at dancer.pm
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
> or, via email, send a message with subject or body 'help' to
> 	dancer-users-request at dancer.pm
> You can reach the person managing the list at
> 	dancer-users-owner at dancer.pm
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of dancer-users digest..."
> Today's Topics:
>     1. Re: Recommendation for REST API (Pedro Melo)
>     2. Delayed template processing (Joerg Fallmann)
>     3. Re: REST plugin (Rick Leir)
>     4. Re: Delayed template processing (Amelia Ireland)
>     5. Re: Delayed template processing (John J. McDermott, CPLP)
>     6. Form Validation Profantity (Richard Reina)
>     7. Re: Form Validation Profantity (Andrew Solomon)
> ----------------------------------------------------------------------
> Message: 1
> Date: Tue, 13 Oct 2015 12:03:10 +0100
> From: Pedro Melo <melo at simplicidade.org>
> To: Nuno Carvalho <smash at cpan.org>, Perl Dancer users mailing list
> 	<dancer-users at dancer.pm>
> Subject: Re: [dancer-users] Recommendation for REST API
> Message-ID:
> 	<CACCxPi2dPiiW-U21Wc7u2CeDjt-b=pViQtSTtEt5qGGdNWQJGw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> Hi,
> On Tue, Oct 13, 2015 at 11:37 AM, Nuno Carvalho <smash at cpan.org> wrote:
>> On Mon, Oct 12, 2015 at 8:16 PM, Pedro Melo <melo at simplicidade.org> wrote:
>>> need to build a REST API with Dancer2. Any recommendations on what
>> plugins,
>>> if any, to use?
>>> I see Dancer2::Plugin::REST, is that the recommended one? It looks good?
>> any
>>> experiences with it?
>>   I always end up doing serialization "myself", instead of relying in
>> plugins. Because many times there will be some edge cases that using
>> the plugin will require a huge workaround. While handling the
>> serialization yourself it's always easier to adapt. And even so I
>> usually end up with very simple and clean applications like:
>> sub '/users' => sub {
>>    to_json MyModel->users;
>> };
>>   If you prefer you can also use the "set serializer" option, to omit
>> the to_json parts, or if you intend to have more than one serializer
>> possible
> Yeah? I have a base class for all my models so I'll probably take that
> route.
> Thank you all,

More information about the dancer-users mailing list