[dancer-users] How to data into webpage

Alex Mestiashvili alex at biotec.tu-dresden.de
Thu Aug 20 09:10:10 BST 2015

On 08/20/2015 04:17 AM, Richard Reina 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

The page is generated from a template,
just pass your variables containing the data from sql to the template,
and the templating engine such as "simple" or "template_toolkit"  ( see
config.yaml )
will take care about displaying your data.

Dancer::Tutorial has pretty good example:
Also have a look on https://metacpan.org/pod/Dancer2::Plugin::Database

More information about the dancer-users mailing list