Re: [dancer-users] Delayed template processing
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 route, instead of computing everything and then /push/ it to the user after minutes. @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 --joerg On 10/14/2015 01:00 PM, dancer-users-request@dancer.pm wrote:
Send dancer-users mailing list submissions to dancer-users@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@dancer.pm
You can reach the person managing the list at dancer-users-owner@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@simplicidade.org> To: Nuno Carvalho <smash@cpan.org>, Perl Dancer users mailing list <dancer-users@dancer.pm> Subject: Re: [dancer-users] Recommendation for REST API Message-ID: <CACCxPi2dPiiW-U21Wc7u2CeDjt-b=pViQtSTtEt5qGGdNWQJGw@mail.gmail.com> Content-Type: text/plain; charset="utf-8"
Hi,
On Tue, Oct 13, 2015 at 11:37 AM, Nuno Carvalho <smash@cpan.org> wrote:
On Mon, Oct 12, 2015 at 8:16 PM, Pedro Melo <melo@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,
On 10/14/2015 6:26 AM, Joerg Fallmann wrote:
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. That is what I get when I pull the info after I've loaded the first chunk.
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 route, instead of computing everything and then /push/ it to the user after minutes. That sounds very much like what I do. I show the initial page, let the user select the desired info and then I go to the appropriate route. I display initial info in a header and footer, and then a js onLoad function grabs the remaining data from another route (similar to your results route). Sometimes that's a lot of JSON data and can take some time do download. I use datatables for the actual load and display for some of the routes.
@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
--joerg
-- John J. McDermott, CPLP Learning and Performance Consultant jjm at jkintl.com 575/737-8556 Check out my security blog posts <http://cybersecurity.learningtree.com> Add an A for the Arts To STEM and get STEAM and a strong engine to move forward.
participants (2)
-
Joerg Fallmann -
John J. McDermott, CPLP