[dancer-users] How to data into webpage

Richard Reina gatorreina at gmail.com
Thu Aug 20 13:58:51 BST 2015


David, Alex & Atilla,

Thank you very much for these well thought out replies. I will try these
solutions and I am sure they will be very helpful.

Again, thank you for taking the time to write such thorough replies.

Richard

2015-08-20 4:56 GMT-05:00 Attila Bárdi <attila.bardi at gmail.com>:

> Hey,
>
> I splited into three part:
>
> 1, the first is the route handler, AJAX  backend, ...
>
> get '/' => sub {
>   template 'rootTemplate', {
>  }
> };
>
> ajax '/getAll' => sub {
>   my $allHashRef = HelperModule->fetchAll_hashref();
>
>  foreach ( keys %$trac) {
>         push @_, {
>             value => "$_",
>             text => "$trac->{$_}",
>         }
>     }
>     return to_json(\@_);
>
>         return to_json(\@_);
> };
>
>
> 2, data visualization: template toolkit, bootstrap, jquery, ...
> 3, data gathering in separated Perl module
>
> In the separated Perl modul I do all of the queries, updates, creation and
> returning the object, hashes, arrays, ... to the caller.
> In this way I can do more efficient testing and a code reusing for example
> in a Perl script.
>
>
>
> On Thu, Aug 20, 2015 at 4:17 AM, Richard Reina <gatorreina at gmail.com>
> wrote:
>
>> Have been learning Dancer2 over the last few weeks and really like it.
>> Wondering if someone can tell me how I can load data from a MySQL database
>> into a dancer rendered page. I am comfortable writing SQL in perl via
>> perl->DBI just don't have any idea how to bring the data from a fetch into
>> a webpage so that I can display it directly on the page or load it into a
>> dropdown menu. Any help is greatly appreciated.
>>
>> Thanks
>>
>> _______________________________________________
>> dancer-users mailing list
>> dancer-users at dancer.pm
>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>>
>>
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150820/73b3e4bc/attachment.html>


More information about the dancer-users mailing list