The following experience (another email thread); using the following in my config.yml charset: utf-8 engines: template_toolkit: ENCODING: utf8 I get the error Error while loading /Users/punkish/Sites/punkish/punkish.pl: YAML Error: Inconsistent indentation level, referer: http://punkish.local/ [Wed Sep 22 06:22:08 2010] [error] [client 127.0.0.1] Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION Which makes me think, why even bother with YAML? This whole respect for white space and indentation is one of the reasons that makes me detest Python, but now I am doing this in Perl. YAML is useful if I am doing some language agnostic data storage, but this is a tiny config file. It would be just as well being just a perl data structure. I would be able to have any kind of nested complexity in my config, and would never have to worry about YAML parsing errors. 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' .. }; -- Puneet Kishor
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. If you want to set all your settings in pure perl, you already can: just use the setting keyword in yourapp.pl. Configuration files, on the other hand, are not meant to be written with a programming language. YAML is a very good and well-kown format for human-readable configuration files. Regards, -- Alexis Sukrieh
Hi Alexis, On Wed, Sep 22, 2010 at 7:15 AM, Alexis Sukrieh <sukria@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 =======================================================================
sounds like you might want to write a plugin that translates perl configuration to YAML. Or something similar. I was annoyed too about YAML that I ran into incompabilities between different implementations even as a novice YAML user, but I figure it's easier to make myself learn YAML than to change Dancer and the way the world is in general. Dancer already has all this liberty concerning deployment and template engines. It seems there is no need for that on configuration side. Doesn't it handle XML configuration as well? On Wed, Sep 22, 2010 at 8:24 AM, P Kishor <punk.kish@gmail.com> wrote:
Hi Alexis,
On Wed, Sep 22, 2010 at 7:15 AM, Alexis Sukrieh <sukria@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 ======================================================================= _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
Le 22/09/2010 14:24, P Kishor a écrit :
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.
Well, Dancer has been written with one main idea in mind: everything should be simple and intuitive. If there is one reason why people like Dancer, it's because of that: it's simple, intuitive and elegant. YAML configuration files contribute to that, it's very handy to just drop a list of key/value pairs in one config.yml file and just start working. Of course you can find many examples of applications whose configuration files are written with a programming language, but I dislike that. Because if you let the user write his configuration files with a script, sooner or later someone will start putting code inside, and that's a pandora box.
YAML is a very good and well-kown format for human-readable configuration files.
Again, who says so? citations?
My experience tells me that. Again, if you want to write pure perl Dancer settings, you can do it. YAML files are there for people who want to keep their settings outside of their code.
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.
I precisely want human-readable here. Again, Dancer is meant to be as easy to handle as possible. It's a key feature. You won't make me change my mind on this ;) Of course, if you really like, you can write a plugin that will do what you want. Regards, -- Alexis Sukrieh
Hi Alexis, On Wed, Sep 22, 2010 at 8:54 AM, Alexis Sukrieh <sukria@sukria.net> wrote:
Le 22/09/2010 14:24, P Kishor a écrit :
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.
Well, Dancer has been written with one main idea in mind: everything should be simple and intuitive.
If there is one reason why people like Dancer, it's because of that: it's simple, intuitive and elegant.
YAML configuration files contribute to that, it's very handy to just drop a list of key/value pairs in one config.yml file and just start working.
Of course you can find many examples of applications whose configuration files are written with a programming language, but I dislike that.
Because if you let the user write his configuration files with a script, sooner or later someone will start putting code inside, and that's a pandora box.
YAML is a very good and well-kown format for human-readable configuration files.
Again, who says so? citations?
My experience tells me that. Again, if you want to write pure perl Dancer settings, you can do it. YAML files are there for people who want to keep their settings outside of their code.
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.
I precisely want human-readable here. Again, Dancer is meant to be as easy to handle as possible. It's a key feature. You won't make me change my mind on this ;)
My intent was not to change your mind, but just to have a conversation. I totally respect your decision to implement config-ing with YAML, but I appreciate the fact that I can also provide the same info as a Perl data structure via settings. YAML itself doesn't bother me -- it is its focus on indentation and white space as being meaningful that bothers me. As I gave my example, the config code fragment for enabling utf-8 as shown on Dancer website croaks with an error. So, I can't even take the "canonical" example and cut and paste it in my code and expect it to work. That, to me, does not make a simple framework. That makes an needlessly fragile framework that is prone to errors based on which way the wind is blowing. Anyway, enough said -- config is such a small part of my overall application that I will either learn how to implement it in YAML (thankfully, only very little learning required) or just use Perl settings. Great framework, by the way. Well on its way to being the best out there.
Of course, if you really like, you can write a plugin that will do what you want.
Regards,
-- Alexis Sukrieh
-- 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 =======================================================================
On Sep 22, 2010, at 11:42 AM, P Kishor wrote:
Hi Alexis,
On Wed, Sep 22, 2010 at 8:54 AM, Alexis Sukrieh <sukria@sukria.net> wrote:
Le 22/09/2010 14:24, P Kishor a écrit :
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.
Well, Dancer has been written with one main idea in mind: everything should be simple and intuitive.
If there is one reason why people like Dancer, it's because of that: it's simple, intuitive and elegant.
YAML configuration files contribute to that, it's very handy to just drop a list of key/value pairs in one config.yml file and just start working.
Of course you can find many examples of applications whose configuration files are written with a programming language, but I dislike that.
Because if you let the user write his configuration files with a script, sooner or later someone will start putting code inside, and that's a pandora box.
YAML is a very good and well-kown format for human-readable configuration files.
Again, who says so? citations?
My experience tells me that. Again, if you want to write pure perl Dancer settings, you can do it. YAML files are there for people who want to keep their settings outside of their code.
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.
I precisely want human-readable here. Again, Dancer is meant to be as easy to handle as possible. It's a key feature. You won't make me change my mind on this ;)
My intent was not to change your mind, but just to have a conversation. I totally respect your decision to implement config-ing with YAML, but I appreciate the fact that I can also provide the same info as a Perl data structure via settings.
YAML itself doesn't bother me -- it is its focus on indentation and white space as being meaningful that bothers me. As I gave my example, the config code fragment for enabling utf-8 as shown on Dancer website croaks with an error. So, I can't even take the "canonical" example and cut and paste it in my code and expect it to work. That, to me, does not make a simple framework. That makes an needlessly fragile framework that is prone to errors based on which way the wind is blowing.
Anyway, enough said -- config is such a small part of my overall application that I will either learn how to implement it in YAML (thankfully, only very little learning required) or just use Perl
I don't recall - does Dancer use Config::Any inside? Would that address this issue?
http://en.wikipedia.org/wiki/YAML says that YAML should handle UTF-8 or UTF-16, so maybe there is indeed a bug involved. If so, where would it be? In Dancer::YAML or further down the stack? On Wed, Sep 22, 2010 at 1:35 PM, Robert Olson <bob@rdolson.org> wrote:
On Sep 22, 2010, at 11:42 AM, P Kishor wrote:
Hi Alexis,
On Wed, Sep 22, 2010 at 8:54 AM, Alexis Sukrieh <sukria@sukria.net> wrote:
Le 22/09/2010 14:24, P Kishor a écrit :
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.
Well, Dancer has been written with one main idea in mind: everything should be simple and intuitive.
If there is one reason why people like Dancer, it's because of that: it's simple, intuitive and elegant.
YAML configuration files contribute to that, it's very handy to just drop a list of key/value pairs in one config.yml file and just start working.
Of course you can find many examples of applications whose configuration files are written with a programming language, but I dislike that.
Because if you let the user write his configuration files with a script, sooner or later someone will start putting code inside, and that's a pandora box.
YAML is a very good and well-kown format for human-readable configuration files.
Again, who says so? citations?
My experience tells me that. Again, if you want to write pure perl Dancer settings, you can do it. YAML files are there for people who want to keep their settings outside of their code.
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.
I precisely want human-readable here. Again, Dancer is meant to be as easy to handle as possible. It's a key feature. You won't make me change my mind on this ;)
My intent was not to change your mind, but just to have a conversation. I totally respect your decision to implement config-ing with YAML, but I appreciate the fact that I can also provide the same info as a Perl data structure via settings.
YAML itself doesn't bother me -- it is its focus on indentation and white space as being meaningful that bothers me. As I gave my example, the config code fragment for enabling utf-8 as shown on Dancer website croaks with an error. So, I can't even take the "canonical" example and cut and paste it in my code and expect it to work. That, to me, does not make a simple framework. That makes an needlessly fragile framework that is prone to errors based on which way the wind is blowing.
Anyway, enough said -- config is such a small part of my overall application that I will either learn how to implement it in YAML (thankfully, only very little learning required) or just use Perl
I don't recall - does Dancer use Config::Any inside? Would that address this issue?
_______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
On Wed, Sep 22, 2010 at 2:24 PM, P Kishor <punk.kish@gmail.com> wrote:
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.
Say most people with a rather extensive experience. You do *not* write configurations using computer formats. Computer formats are for computers, human formats are for humans. As long as humans need to write the file, it should be in human format. It should have as little of "computer-talk" to actual content ratio as possible. Sigils, quotes, stuff like that are not recommended to enforce upon the user in the "human" realm where configuration lives. This is the same old discussion as "I want to use XML for my configuration file".
YAML is a very good and well-kown format for
human-readable configuration files.
Again, who says so? citations?
This is not a question of "preference" but of correct usage. Configuration language is more readable than programming language. I don't see much point in discussion about this, and I won't start looking for citations. For all I care, you could force your users to write configurations in XML, JSON or Brainfuck. But if you're doing so you're making a mistake. This is the same type of mistake as hardcoding data all over the file instead of using variables. simply incorrect usage. By the way, you'll see this "user-driven configuration" behavior in other projects such as Catalyst which I would count as "if it's good enough for Catalyst, it's definitely good enough for us" because they have *a lot* more experience.
Besides, who wants human-readable? I want programmer-readable.
A programmer is a user first. Do you read documentation in POD form or some form that was rendered from POD (text, HTML, etc.)? Why does CPAN show HTML and not POD? Why does perldoc show text and not POD? Why does "man" show text and not groff? For this exact reason.
No human reads the config files on a daily basis, but my computer does all the time.
It's easier for a computer to translate human-readable configuration 1000 times an hour than it is for a human to translate from machine-readable once a day. You should make it easier for the user, not the computer.
I just gave you an example above where a simple indentation can cause misunderstanding both to the human and the computer.
That's an issue of YAML and you're right about it. YAML was chosen for its strength (being able to specify a LOT while still keeping it very readable), but it doesn't mean it doesn't have weaknesses and that is definitely one. Catalyst solved it using Config::Any but that forces you more dependencies so it isn't trivial for us.
participants (5)
-
Alexis Sukrieh -
Maurice Mengel -
P Kishor -
Robert Olson -
sawyer x