in reply to Dancer 2 yaml config file

Can anyone spot what I'm doing wrong?

looks like you're using yaml instead of code, and its tricking your mind, see https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Config.pod#MANIPULATING-SETTINGS-VIA-CODE

Config is a hash, a hash of hashes, meaning there is only one %engines, there can be only one engines

{ 'engines' => { 'template' => { 'template_toolkit' => { 'start_tag' => '<%', 'end_tag' => '%>', }, }, 'session' => { 'DBIC' => { 'user' => '', 'pass' => '', ... }, }, }, 'template' => 'template_toolkit', 'session' => 'DBIC', ... }

IMHO, this is one of those pitfalls that shouldn't exist :) Dancer provides so many conveniences, why not a reminder that key are colliding/being clobbered

  • Comment on Re: Dancer 2 yaml config file (is a hash of hashes ... key collision/clobbering is a common pitfall)
  • Download Code

Replies are listed 'Best First'.
Re^2: Dancer 2 yaml config file (is a hash of hashes ... key collision/clobbering is a common pitfall)
by soundX (Acolyte) on Feb 09, 2015 at 18:25 UTC
    Ah, ok yes that makes sense, got it working (at last) with:
    engines: session: DBIC: dsn: "dbi:Pg:database=dbname" schema_class: "xxxx::Schema" user: "" password: "" #resultset: id_column: "id" data_column: "data" template: template_toolkit: start_tag: '<%' end_tag: '%>' session: "DBIC" template: "template_toolkit"
    Thank you.