Skip Menu |

This queue is for tickets about the Mojolicious-Plugin-YamlConfig CPAN distribution.

Report information
The Basics
Id: 76551
Status: resolved
Priority: 0/
Queue: Mojolicious-Plugin-YamlConfig

People
Owner: Nobody in particular
Requestors: jpl [...] plosquare.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.1.4
Fixed in: (no value)



Subject: Incorrect error reporting
The text of 'die' in YamlConfig::parse is not reported when application is run with morbo. For example, if YAML::XS is not installed, the application will die with an uninformative message "Can't load application "script/boilerplate.pl": at (eval 105) line 5." This misreporting seems to be caused by the line "local $@;" in YamlConfig::parse. See also https://github.com/kraih/mojo/issues/318
Hi Jan, thanks for your report. On Sat Apr 14 14:58:28 2012, jploski wrote: Show quoted text
> "Can't load application "script/boilerplate.pl": at (eval 105) line
5." Show quoted text
> > This misreporting seems to be caused by the line "local $@;" in > YamlConfig::parse. > > See also https://github.com/kraih/mojo/issues/318
I cannot reproduce this: An easy way to let YamlConfig die in sub parse is, setting MOJO_YAML to something not existant, so here I set it to YAML::Foo: $ MOJO_YAML=YAML::Foo morbo foo.pl YAML::Foo is not supported, use at your own risk at /opt/perl5/perls/perl- 5.14.2/lib/site_perl/5.14.2/Mojolicious/Plugin/YamlConfig.pm line 18. [Tue May 1 16:19:08 2012] [debug] Reading config file "/lfs/home/danielt/tmp/foo.yaml". Can't load application "foo.pl": Can't locate YAML/Foo.pm in @INC (@INC contains: /opt/perl5/perls/perl-5.14.2/lib/site_perl/5.14.2/x86_64-linux /opt/perl5/perls/perl-5.14.2/lib/site_perl/5.14.2 /opt/perl5/perls/perl- 5.14.2/lib/5.14.2/x86_64-linux /opt/perl5/perls/perl-5.14.2/lib/5.14.2 . /opt/perl5/perls/perl-5.14.2/bin/../lib) at (eval 251) line 1, <$handle> line 1. `Can't locate YAML::Foo' looks reasonable to me. Can you provide failing code please? Also your Perl version might be interesting. Bye, DaTa
From: jpl [...] plosquare.com
Attached is a small failing example. The configuration file myapp.yaml is intentionally left at zero size to trigger a "die". But the error message is nonsense: /tmp> morbo myapp.pl [Wed May 2 17:28:41 2012] [debug] Reading config file "/tmp/myapp.yaml". Can't load application "myapp.pl": Bad file descriptor at (eval 105) line 5. Similarly I won't see "foobar" in the error message if I insert a die "foobar" anywhere in YamlConfig::parse - unless I comment out the "local $@" line - then it works. This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi (with 56 registered patches, see perl -V for more detail) Standard perl package from Debian stable. On Tue May 01 10:23:00 2012, DATA wrote: Show quoted text
> Hi Jan, > > thanks for your report. > > On Sat Apr 14 14:58:28 2012, jploski wrote:
> > "Can't load application "script/boilerplate.pl": at (eval 105) line
> 5."
> > > > This misreporting seems to be caused by the line "local $@;" in > > YamlConfig::parse. > > > > See also https://github.com/kraih/mojo/issues/318
> > I cannot reproduce this: > > An easy way to let YamlConfig die in sub parse is, setting MOJO_YAML to > something not existant, so here I set it to YAML::Foo: > > $ MOJO_YAML=YAML::Foo morbo foo.pl > YAML::Foo is not supported, use at your own risk at > /opt/perl5/perls/perl- > 5.14.2/lib/site_perl/5.14.2/Mojolicious/Plugin/YamlConfig.pm line 18. > [Tue May 1 16:19:08 2012] [debug] Reading config file > "/lfs/home/danielt/tmp/foo.yaml". > Can't load application "foo.pl": Can't locate YAML/Foo.pm in @INC (@INC > contains: /opt/perl5/perls/perl-5.14.2/lib/site_perl/5.14.2/x86_64-linux > /opt/perl5/perls/perl-5.14.2/lib/site_perl/5.14.2 /opt/perl5/perls/perl- > 5.14.2/lib/5.14.2/x86_64-linux /opt/perl5/perls/perl-5.14.2/lib/5.14.2 . > /opt/perl5/perls/perl-5.14.2/bin/../lib) at (eval 251) line 1, <$handle> > line 1. > > `Can't locate YAML::Foo' looks reasonable to me. > > Can you provide failing code please? > > Also your Perl version might be interesting. > > Bye, > > DaTa
Subject: myapp.yaml
Subject: myapp.pl
#!/usr/bin/env perl use Mojolicious::Lite; # Documentation browser under "/perldoc" plugin 'PODRenderer'; plugin 'YamlConfig'; get '/' => sub { my $self = shift; $self->render('index'); }; app->start; __DATA__ @@ index.html.ep % layout 'default'; % title 'Welcome'; Welcome to the Mojolicious real-time web framework! @@ layouts/default.html.ep <!DOCTYPE html> <html> <head><title><%= title %></title></head> <body><%= content %></body> </html>
Subject: Re: [rt.cpan.org #76551] Incorrect error reporting
Date: Wed, 2 May 2012 22:06:20 +0200
To: Jan Ploski via RT <bug-Mojolicious-Plugin-YamlConfig [...] rt.cpan.org>
From: Danijel Tasov <data [...] cpan.org>
Show quoted text
> /tmp> morbo myapp.pl > [Wed May 2 17:28:41 2012] [debug] Reading config file "/tmp/myapp.yaml". > Can't load application "myapp.pl": Bad file descriptor at (eval 105) line 5. > > Similarly I won't see "foobar" in the error message if I insert a die > "foobar" anywhere in YamlConfig::parse - unless I comment out the "local > $@" line - then it works.
Very strange: Just built a vanilla perl 5.10.1 and 5.12.4: $ /opt/perl5/perls/perl-5.10.1/bin/morbo myapp.pl [Wed May 2 22:01:20 2012] [debug] Reading config file "/lfs/home/danielt/tmp/rt76551/myapp.yaml". Can't load application "myapp.pl": Invalid config "/lfs/home/danielt/tmp/rt76551/myapp.yaml". at /opt/perl5/perls/perl-5.14.2/lib/site_perl/5.14.2/Mojolicious/Plugin/YamlConfig.pm line 47, <$handle> line 1. ^C $ /opt/perl5/perls/perl-5.12.4/bin/morbo myapp.pl [Wed May 2 22:01:26 2012] [debug] Reading config file "/lfs/home/danielt/tmp/rt76551/myapp.yaml". Can't load application "myapp.pl": Invalid config "/lfs/home/danielt/tmp/rt76551/myapp.yaml". at /opt/perl5/perls/perl-5.14.2/lib/site_perl/5.14.2/Mojolicious/Plugin/YamlConfig.pm line 47, <$handle> line 1. ^C $ /opt/perl5/perls/perl-5.14.2/bin/morbo myapp.pl [Wed May 2 22:01:34 2012] [debug] Reading config file "/lfs/home/danielt/tmp/rt76551/myapp.yaml". Can't load application "myapp.pl": Invalid config "/lfs/home/danielt/tmp/rt76551/myapp.yaml". at /opt/perl5/perls/perl-5.14.2/lib/site_perl/5.14.2/Mojolicious/Plugin/YamlConfig.pm line 47, <$handle> line 1. ^C Found a debian stable box: $ PERL5LIB=$PWD/local-lib/lib/perl5 /usr/bin/perl local-lib/bin/morbo myapp.pl [Wed May 2 21:58:51 2012] [debug] Reading config file "/home/danielt/tmp/rt76551/myapp.yaml". Can't load application "myapp.pl": Bad file descriptor at (eval 105) line 5. ^C .. going to think about that a bit
From: jpl [...] plosquare.com
I constructed a minimal test which I think reproduces the issue without Mojolicious. morbo.pl simulates real morbo's inclusion of the failing myapp.pl (here replaced by "test.pl"). Maybe this will help. It behaves the same way on Amazon Linux (with Perl 5.10.1) and an old Ubuntu (with Perl 5.8.7).
Subject: test.pl
{ local $@; die "you will not see me"; }
Subject: morbo.pl
#my $file = 'myapp.pl'; my $file = 'test.pl'; unless ($app = do $file) { die qq/1) Can\'t load application "$file": $@/ if $@; die qq/2) Can\'t load application "$file": $!/ unless defined $app; die qq/3) Can\'t load application\' "$file". / unless $app; }
New version released. 0.1.5 - 2012-05-15 - Fix RT #76551 (jploski)