Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by Anonymous Monk
on Feb 09, 2015 at 00:42 UTC ( [id://1115982]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1115982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-16 09:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found