[Dancer-users] config.yml

David Precious davidp at preshweb.co.uk
Tue Jan 4 00:52:56 CET 2011


On Monday 03 January 2011 23:32:35 Todd Bruner wrote:
> Could some one point me to at what I'm doing wrong in the config.yml?
> 
> I'm following the tutorial and the advent stuff and trying to enable
> plack_middlewares.
> 
> Here's my config.yml
> 
> layout: "main"
> charset: "UTF-8"
> template: "template_toolkit"
> engines:
>     template_toolkit:
>         encoding: 'utf8'
>         start_tag: '[%'
>         end_tag: '%]'
> log: 'debug'
> show_errors: 'true'
> plack_middlewares:
>     Debug:
>         - panels
>             -
>             - Memory
>             - DBITrace
>             - Timer
> 
> 
> Here's the error message when I plackup

<snipped>

Looks like that error trace included lots of useless info, but not the 
pertinent info - the reason that the YAML wasn't parsed.

Having dumped the above into a separate file, I tried the following:


[davidp at supernova:~]$ perl -MYAML -e 'YAML::LoadFile "tmp/config.yml.todd";'
YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 14
   Document: 1
 at /usr/local/share/perl/5.10.0/YAML.pm line 36

So, the answer is indeed that the YAML is not valid.

Looking at it, I believe it's the following:


> plack_middlewares:
>     Debug:
>         - panels
>             -
>             - Memory

The cookbook says this should be:

    plack_middlewares:
      -
        - Debug
        - panels
        -
          - DBITrace
          - Memory

That's according to:

http://search.cpan.org/~xsawyerx/Dancer-1.2003/lib/Dancer/Cookbook.pod#Plack_middlewares

Can you give that a try, and let us know if that works?

The comments in the example in the cookbook mention that "first element of the 
array is the name of the middleware, following elements are the configuration 
of the middleware".

I do however think that syntax is ugly, and looks wrong to the eye.

I'd much rather see, e.g.:

  plack_middlewares:
      Debug:
          panels:
              - Memory
              - DBITrace
              [etc]

I suspect there's a good reason it wasn't done that way, though, but I don't 
have a chance to look in to it further right now.


Cheers

Dave P


-- 
David Precious <davidp at preshweb.co.uk>
http://blog.preshweb.co.uk/    www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/identica    www.lyricsbadger.co.uk

  "Programming is like sex. One mistake and you have to support 
  it for the rest of your life". (Michael Sinz)


More information about the Dancer-users mailing list