When Dancer came out, I exclaimed that "Dancer is a breath of fresh air in the convoluted world of Perl web frameworks." (see http://perldancer.org/). However, there is still much to be done. Consider the error message below. What it really was trying to tell me what that I had a couple of tabs in my "development.yml" Could the error messages be made more sane by default? Many thanks for the consideration. ---- Error while loading /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl: Unable to parse the configuration file: /Volumes/roller/Users/punkish/Sites_development/earthbase/environments/development.yml: Died at /opt/local/lib/perl5/site_perl/5.14.1/YAML/Loader.pm line 676, <$IN> line 1. at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line 202 Dancer::Config::load_settings_from_yaml('/Volumes/roller/Users/punkish/Sites_development/earthbase/env...') called at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line 182 Dancer::Config::load('Dancer::Config') called at /opt/local/lib/perl5/site_perl/5.14.1/Dancer.pm line 258 Dancer::import('Dancer') called at /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl line 2 Plack::Sandbox::_2fVolumes_2froller_2fUsers_2fpunkish_2fSites_development_2fearthbase_2fbin_2fapp_2epl::BEGIN() called at /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl line 2 eval {...} called at /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl line 2 require /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl called at (eval 7) line 3 eval 'package Plack::Sandbox::_2fVolumes_2froller_2fUsers_2fpunkish_2fSites_development_2fearthbase_2fbin_2fapp_2epl; { my $app = do $_file; if ( !$app && ( my $error = $@ || $! )) { die $error; } $app; } ;' called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Util.pm line 118 Plack::Util::_load_sandbox('/Volumes/roller/Users/punkish/Sites_development/earthbase/bin...') called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Util.pm line 155 Plack::Util::load_psgi('/Volumes/roller/Users/punkish/Sites_development/earthbase/bin...') called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Runner.pm line 176 Plack::Runner::__ANON__() called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Runner.pm line 23 Plack::Runner::__ANON__() called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Runner.pm line 23 Plack::Runner::__ANON__() called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Runner.pm line 23 Plack::Runner::__ANON__() called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Runner.pm line 23 Plack::Runner::__ANON__() called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Loader.pm line 59 Plack::Loader::preload_app('Plack::Loader=HASH(0x7fbf320651e0)', 'CODE(0x7fbf3206a000)') called at /opt/local/lib/perl5/site_perl/5.14.1/Plack/Runner.pm line 260 Plack::Runner::run('Plack::Runner=HASH(0x7fbf32010dd8)') called at /opt/local/bin/plackup line 10 BEGIN failed--compilation aborted at /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl line 2. ---- -- Puneet Kishor http://punkish.org science http://earth-base.org
On Sun, Jun 24, 2012 at 3:59 PM, Mr. Puneet Kishor <punk.kish@gmail.com>wrote:
However, there is still much to be done. Consider the error message below.
Oh, we're basically against having proper or sane error messages. Insane error messages build character!
What it really was trying to tell me what that I had a couple of tabs in my "development.yml"
Could the error messages be made more sane by default?
There are several ways and they were often discussed. The problem stems from this being a curried error, meaning it comes from elsewhere. This time from the YAML module. The YAML module said it failed, and we're currying the error it indicated. Unfortunately that error is not very understandable. Like I said, we did discuss how to make these things easier for end-users. One suggestion by Dams was to check YAML ourselves and provide a proper error message. However, this would become quite difficult in Dancer 2 since it will have various configuration engines (to allow you use to JSON, INI or other formats you might like more than YAML). We would not be able to write our own meta-parsers for each format and check it before the actual format parser parses it. It's not very clever. Instead, another way is to provide a cleaner more understandable output when YAML fails. Unfortunately we can't always control how it failed. We do try to make it clear it's the parser by writing "Unable to parse the configuration file". We're more than open on any suggestion you may have on how to make this easier. So, unfortunately this is much less of a "Dancer problem" and more of a "YAML problem".
On Jun 24, 2012, at 6:40 PM, sawyer x wrote:
On Sun, Jun 24, 2012 at 3:59 PM, Mr. Puneet Kishor <punk.kish@gmail.com>wrote:
However, there is still much to be done. Consider the error message below.
Oh, we're basically against having proper or sane error messages. Insane error messages build character!
What it really was trying to tell me what that I had a couple of tabs in my "development.yml"
Could the error messages be made more sane by default?
..
So, unfortunately this is much less of a "Dancer problem" and more of a "YAML problem".
Sadly, this makes Dancer (seem) more complicated than it is, and that is bad for Dancer. Perhaps it is time to kick out YAML. I am glad there will be options in the future, as I would promptly move to JSON. I see absolutely no sense in using YAML with its quirkiness. Am looking forward to the upgrade. -- Puneet Kishor
On Sun, Jun 24, 2012 at 6:18 PM, Mr. Puneet Kishor <punk.kish@gmail.com>wrote:
Sadly, this makes Dancer (seem) more complicated than it is, and that is bad for Dancer. Perhaps it is time to kick out YAML.
It's not about kicking one or the other. It's about providing more options and better defaults. Fortunately, as I stated, Dancer 2 will allow you to pick whatever you want. We will also make an effort to clarify where problems are. You are more than welcome to help us with that.
I am glad there will be options in the future, as I would promptly move to JSON.
I'm personally more excited about INI. It's easy to read and edit. JSON is not for end users.
I see absolutely no sense in using YAML with its quirkiness.
YAML provided us with something that is: 1. familiar to Perl programmers 2. easy to write 3. easy to read (for non-Perl programmers too) However, it does indeed have quirks, and unfortunately not a single parser who gives us what we want: 1. maintained 2. minimal overhead (memory, CPU) 3. advanced data structures Am looking forward to the upgrade.
You're more than welcome to try and run your application on Dancer 2 right away. We need all the feedback we can get! Try to use the branch "feature/sawyer_goes_nuts". It has more up-to-date changes.
On Jun 24, 2012, at 8:59 PM, sawyer x wrote:
You're more than welcome to try and run your application on Dancer 2 right away. We need all the feedback we can get!
Try to use the branch "feature/sawyer_goes_nuts". It has more up-to-date
I have two Dancer-backed projects -- ## Earth Base http://earth-base.org is approx. 7K lines of Perl code, and I can't afford to experiment with it. It might look good, however, on the dance floor, as a Dancer example. http://earth-base.org/apps leads to various apps that serve either data (in JSON) coming from Postgres or various other binary data stores, or web apps made from the apps that serve data. For example, http://earth-base.org/geomaps ## punkish http://punkish.org is also completely Dancer-based, but much simpler. I converted my web site from being db backed to 100% Markdown text files backed. What a relief. I will experiment with converting that to Dancer2. Many thanks, -- Puneet Kishor
On Sun, Jun 24, 2012 at 6:49 PM, Mr. Puneet Kishor <punk.kish@gmail.com>wrote:
I have two Dancer-backed projects --
## Earth Base
http://earth-base.org is approx. 7K lines of Perl code, and I can't afford to experiment with it. It might look good, however, on the dance floor, as a Dancer example. http://earth-base.org/apps leads to various apps that serve either data (in JSON) coming from Postgres or various other binary data stores, or web apps made from the apps that serve data. For example, http://earth-base.org/geomaps
It looks very nice (though, I saw a CSS problem in earth-base.org/apps, which shows your footer in the middle for some reason), and I think they would very nice on the dance floor. We will be able to add them if you just submit a pull request with details about each (a line or two about what they are). If you're not comfortable with a pull request, you can email me the details. Use my CPAN address (xsawyerx).
## punkish
http://punkish.org is also completely Dancer-based, but much simpler. I converted my web site from being db backed to 100% Markdown text files backed. What a relief. I will experiment with converting that to Dancer2.
It might just be the first Dancer 2 app online, though I'm working on another one, so we'll see who wins the race! :) Also, you don't have to experiment with live code, you can run it locally in a sandbox!
Many thanks,
And to you too. :) S.
On 06/24/2012 11:29 AM, sawyer x wrote:
You're more than welcome to try and run your application on Dancer 2 right away. We need all the feedback we can get!
Speaking of Dancer 2: Tried it with an internal website, and all works well except for common plugins (Dancer::Plugins::Email, for one). Is there a quick way to adapt a Dancer 1 plugin to Dancer 2 ? or a tutorial for Dancer2 plugins ? -gordon
On Mon, Jun 25, 2012 at 8:15 AM, Assaf Gordon <gordon@cshl.edu> wrote:
On 06/24/2012 11:29 AM, sawyer x wrote:
You're more than welcome to try and run your application on Dancer 2 right away. We need all the feedback we can get!
Speaking of Dancer 2: Tried it with an internal website, and all works well except for common plugins (Dancer::Plugins::Email, for one).
Yay! Those are great news! Is there a quick way to adapt a Dancer 1 plugin to Dancer 2 ? or a tutorial
for Dancer2 plugins ?
The plugin migration coordinator is Dams. He is in charge of documenting how to migrate plugins. It would be very helpful if you could team up and start putting out explanations for the community on how to migrate. Please join us at #dancer (irc.perl.org) to discuss this whole thing.
On Sun, Jun 24, 2012 at 3:10 PM, sawyer x <xsawyerx@gmail.com> wrote:
On Sun, Jun 24, 2012 at 3:59 PM, Mr. Puneet Kishor <punk.kish@gmail.com> wrote:
Could the error messages be made more sane by default?
There are several ways and they were often discussed.
I don't remember following such discussions so forgive me if I restate some already discussed suggestions.
Instead, another way is to provide a cleaner more understandable output when YAML fails. Unfortunately we can't always control how it failed. We do try to make it clear it's the parser by writing "Unable to parse the configuration file". We're more than open on any suggestion you may have on how to make this easier.
I think this is sane, and the output message actually said that there was a problem in parsing the configuration file: ---- Error while loading /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl: Unable to parse the configuration file: /Volumes/roller/Users/punkish/Sites_development/earthbase/environments/development.yml: Died at /opt/local/lib/perl5/site_perl/5.14.1/YAML/Loader.pm line 676, <$IN> line 1. at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line 202 Dancer::Config::load_settings_from_yaml('/Volumes/roller/Users/punkish/Sites_development/earthbase/env...') called at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line 182 Dancer::Config::load('Dancer::Config') called at /opt/local/lib/perl5/site_perl/5.14.1/Dancer.pm line 258 ... ---- The fact is that - probably - it was followed by a lot of other things. Were it written like this, maybe it would be less frustrating: ---- Unable to parse the configuration file (check syntax for errors) Configuration file is at /Volumes/roller/Users/punkish/Sites_development/earthbase/environments/development.yml Application is at /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl Died at /opt/local/lib/perl5/site_perl/5.14.1/YAML/Loader.pm line 676, <$IN> line 1. at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line 202 Dancer::Config::load_settings_from_yaml('/Volumes/roller/Users/punkish/Sites_development/earthbase/env...') called at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line 182 Dancer::Config::load('Dancer::Config') called at /opt/local/lib/perl5/site_perl/5.14.1/Dancer.pm line 258 ... ----- i.e. just make the message stand out with respect to the additional debug info. It would also help to have some hints about how to check for errors in the configuration file, e.g. point out to tools (if exist) for the main configuration loaders (I only used YAML so I don't know about any other, if they exist). My 2c, Flavio.
On Jun 24, 2012, at 9:51 PM, Flavio Poletti wrote:
I think this is sane, and the output message actually said that there was a problem in parsing the configuration file:
---- Error while loading /Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl: Unable to parse the configuration file:
While the error did say that it was "Unable to parse the configuration file," it didn't say why. If the error had said that it croaked in a "tab" character, well, that would have been drastically different. Of course, the rest of the gobbledegook didn't help. Fwiw, now I do remember a discussion about this a while back. Took me a while to get bitten by this today. -- Puneet Kishor
participants (4)
-
Assaf Gordon -
Flavio Poletti -
Mr. Puneet Kishor -
sawyer x