[Dancer-users] YAML, why?

P Kishor punk.kish at gmail.com
Wed Sep 22 14:24:09 CEST 2010


Hi Alexis,

On Wed, Sep 22, 2010 at 7:15 AM, Alexis Sukrieh <sukria at sukria.net> wrote:
> Le 22/09/2010 13:37, P Kishor a écrit :
>
>> Would be nice if there were any option which would allow me to just
>> use pure perl to set my config values, kinda like
>>
>> %CONFIG = {
>> 'charset' =>  'utf-8'
>> 'engines' =>  'template_toolkit'
>> ..
>>
>> };
>
> I'm sorry but I disagree on this.


You are the creator of Dancer, so not only am I pre-disposed to having
very high regard for your position, I will also defer to it.
Nevertheless, I ask the question (and, I hope you don't mind the
disagreement) --


> Configuration files, on the other hand, are not meant to be written with a
> programming language.

who says so? I use PDL (Perl Data Language), a highly complex and
powerful software, probably the most complex I have ever used, and all
its configuration required to build it are done using a extremely
readable perl data structure.

> YAML is a very good and well-kown format for
> human-readable configuration files.
>

Again, who says so? citations?

Besides, who wants human-readable? I want programmer-readable. No
human reads the config files on a daily basis, but my computer does
all the time. I just gave you an example above where a simple
indentation can cause misunderstanding both to the human and the
computer.

White space is a powerful and dangerous concept (like the gaps in
music). Computers are dumb, and trying to have them understand white
space is like playing with knives. In YAML there is a huge difference
between

charset: utf-8
    engines:
      template_toolkit:
        ENCODING: utf8

and

charset: utf-8
engines:
      template_toolkit:
           ENCODING: utf8



>
> If you want to set all your settings in pure perl, you already can: just use
> the setting keyword in yourapp.pl.
>
>
>

Yeah, I know I can do that, and perhaps I will. I was just hoping to
store my config.yml itself as a perl code fragment.

Anyway. This is a digression from my more immediate problem of not
being able to show nice curly quotes and accents in my web page
without manually encoding unicode to html entities.



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================


More information about the Dancer-users mailing list