I have a Dancer app with a registration form and a database. Testing produces this error message: Cannot bind a reference Stack main in astro/app/bin/app.pl l. 7 Dancer in /sw/lib/perl5/site_perl/5.16.2/Dancer.pm l. 480 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 207 Dancer::Handler::Standalone in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler/Standalone.pm l. 36 HTTP::Server::Simple in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple.pm l. 271 HTTP::Server::Simple in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple.pm l. 307 HTTP::Server::Simple in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple.pm l. 402 HTTP::Server::Simple::PSGI in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple/PSGI.pm l. 103 HTTP::Server::Simple::PSGI in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple/PSGI.pm l. 103 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 123 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 76 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 113 Try::Tiny in /sw/lib/perl5/site_perl/5.16.2/Try/Tiny.pm l. 100 Dancer::Exception in /sw/lib/perl5/site_perl/5.16.2/Dancer/Exception.pm l. 47 Dancer::Exception in /sw/lib/perl5/site_perl/5.16.2/Dancer/Exception.pm l. 35 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 107 Dancer::Object in /sw/lib/perl5/site_perl/5.16.2/Dancer/Object.pm l. 16 Dancer::Error in /sw/lib/perl5/site_perl/5.16.2/Dancer/Error.pm l. 38 Dancer::Error in /sw/lib/perl5/site_perl/5.16.2/Dancer/Error.pm l. 284 Nothing under Stack relates to the code I've written so all I have to go on is "Cannot bind a reference". Not much detail there, either. gvim
On 06/03/2013 08:24 PM, gvim wrote:
I have a Dancer app with a registration form and a database. Testing produces this error message:
Cannot bind a reference
Stack main in astro/app/bin/app.pl l. 7 Dancer in /sw/lib/perl5/site_perl/5.16.2/Dancer.pm l. 480 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 207 Dancer::Handler::Standalone in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler/Standalone.pm l. 36 HTTP::Server::Simple in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple.pm l. 271 HTTP::Server::Simple in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple.pm l. 307 HTTP::Server::Simple in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple.pm l. 402 HTTP::Server::Simple::PSGI in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple/PSGI.pm l. 103 HTTP::Server::Simple::PSGI in /sw/lib/perl5/site_perl/5.16.2/HTTP/Server/Simple/PSGI.pm l. 103 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 123 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 76 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 113 Try::Tiny in /sw/lib/perl5/site_perl/5.16.2/Try/Tiny.pm l. 100 Dancer::Exception in /sw/lib/perl5/site_perl/5.16.2/Dancer/Exception.pm l. 47 Dancer::Exception in /sw/lib/perl5/site_perl/5.16.2/Dancer/Exception.pm l. 35 Dancer::Handler in /sw/lib/perl5/site_perl/5.16.2/Dancer/Handler.pm l. 107 Dancer::Object in /sw/lib/perl5/site_perl/5.16.2/Dancer/Object.pm l. 16 Dancer::Error in /sw/lib/perl5/site_perl/5.16.2/Dancer/Error.pm l. 38 Dancer::Error in /sw/lib/perl5/site_perl/5.16.2/Dancer/Error.pm l. 284
Nothing under Stack relates to the code I've written so all I have to go on is "Cannot bind a reference". Not much detail there, either.
I would help if you post your source code for your Dancer application. Regards Racke -- LinuXia Systems => http://www.linuxia.de/ Expert Interchange Consulting and System Administration ICDEVGROUP => http://www.icdevgroup.org/ Interchange Development Team
On Mon, 03 Jun 2013 20:32:47 +0200 "Stefan Hornburg (Racke)" <racke@linuxia.de> wrote:
On 06/03/2013 08:24 PM, gvim wrote:
I have a Dancer app with a registration form and a database. Testing produces this error message:
Cannot bind a reference
[...]
Nothing under Stack relates to the code I've written so all I have to go on is "Cannot bind a reference". Not much detail there, either.
I would help if you post your source code for your Dancer application.
This - without seeing the code, we're guessing. However, a quick google for "Cannot bind a reference" suggests it's an error you get from DBI when you mistakenly pass a reference as a bind var when executing a query - so check what vars you're using (whether you're using DBI directly, or using Dancer::Plugin:Database). -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
This - without seeing the code, we're guessing.
However, a quick google for "Cannot bind a reference" suggests it's an error you get from DBI when you mistakenly pass a reference as a bind var when executing a query - so check what vars you're using (whether you're using DBI directly, or using Dancer::Plugin:Database).
My approach has been to keep Dancer code inside the Routes module and out of everything else (so far) so the other modules 'use DBI'. Maybe the price you pay for this approach is less detail in the error messages? gvim
I would help if you post your source code for your Dancer application.
Regards Racke
Most of my code in modules except routing: ************************** package Astro::Routes; use Dancer qw(:syntax); use Astro::Planets; use Astro::Login; use Astro::Logout; use Astro::Register; use Astro::Astrologers; post '/register' => sub { my %params = params; my %val = %{Astro::Register::run(\%params)}; if ($val{passed}) { redirect '/response/registered.html' } else { template 'input_errors', { missing => $val{missing}, invalid => $val{invalid}, unknown => $val{unknown} }} }; post '/login' => sub { Astro::Login::run }; post '/planets' => sub { Astro::Planets::run }; post '/logout' => sub { Astro::Logout::run }; get '/astrologers' => sub { Astro::Astrologers::run }; 1; ******************************** The registration form submission which produced the error hits the '/register' route. gvim
On Mon, 03 Jun 2013 19:50:40 +0100 gvim <gvimrc@gmail.com> wrote:
I would help if you post your source code for your Dancer application.
Regards Racke
Most of my code in modules except routing: [...] post '/register' => sub { my %params = params; my %val = %{Astro::Register::run(\%params)}; if ($val{passed}) { redirect '/response/registered.html' } else { template 'input_errors', { missing => $val{missing}, invalid => $val{invalid}, unknown => $val{unknown} }} }; [...]
The registration form submission which produced the error hits the '/register' route.
I see nothing in the code above that could raise the error you are seeing, so I suspect the problem lies within Astro::Register::run(). -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
On 03/06/2013 19:57, David Precious wrote:
I see nothing in the code above that could raise the error you are seeing, so I suspect the problem lies within Astro::Register::run().
That's the problem. Astro::Register in turn uses other custom modules but Dancer doesn't seem to be able to reveal the details of the binding error. I would have to send you the code for the whole application, which isn't realistic. gvim
On Mon, 03 Jun 2013 20:01:43 +0100 gvim <gvimrc@gmail.com> wrote:
On 03/06/2013 19:57, David Precious wrote:
I see nothing in the code above that could raise the error you are seeing, so I suspect the problem lies within Astro::Register::run().
That's the problem. Astro::Register in turn uses other custom modules but Dancer doesn't seem to be able to reveal the details of the binding error. I would have to send you the code for the whole application, which isn't realistic.
Well, I've at least pointed at the likely cause. You could try running your app under Carp::Always to make warn/die provide stack traces, e.g. perl -MCarp::Always bin/app.pl That might help. Of course, it's not helpful if Dancer isn't giving you a stack trace with show_errors on - I'll see if I can reproduce that. -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
Shouldn't Dancer's error traceback include the user code? i put the request into the bug tracker long ago, but no comments. Do you see a technical reason for not show user code too? (i dont, and in my non-dancer code it works that way). Niels L On Mon, 2013-06-03 at 20:10 +0100, David Precious wrote:
On Mon, 03 Jun 2013 20:01:43 +0100 gvim <gvimrc@gmail.com> wrote:
On 03/06/2013 19:57, David Precious wrote:
I see nothing in the code above that could raise the error you are seeing, so I suspect the problem lies within Astro::Register::run().
That's the problem. Astro::Register in turn uses other custom modules but Dancer doesn't seem to be able to reveal the details of the binding error. I would have to send you the code for the whole application, which isn't realistic.
Well, I've at least pointed at the likely cause.
You could try running your app under Carp::Always to make warn/die provide stack traces, e.g.
perl -MCarp::Always bin/app.pl
That might help.
Of course, it's not helpful if Dancer isn't giving you a stack trace with show_errors on - I'll see if I can reproduce that.
On Mon, 03 Jun 2013 22:08:18 +0200 Niels Larsen <niels@genomics.dk> wrote:
Shouldn't Dancer's error traceback include the user code?
Yes. I just scaffolded a fresh app, added a call to Foo->foo(), and in lib/Foo.pm, added a die() call. Hitting the app, I get the Dancer error page, with the error message right at the top: Helpful error message at /home/davidp/tmp/dancertests/errorreporting/lib/Foo.pm line 4, <DATA> line 16. Oddly though, the stack presented includes bin/app.pl and Dancer's guts only, not lib/errorreporting.pm (the app code) or lib/Foo.pm (the "module") that died). I'll look into that when I have a moment. -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
On Mon, Jun 03, 2013 at 08:01:43PM +0100, gvim wrote:
That's the problem. Astro::Register in turn uses other custom modules but Dancer doesn't seem to be able to reveal the details of the binding error. I would have to send you the code for the whole application, which isn't realistic.
Can you reduce it to a minimal example that shows the error? Of course, by doing that you'll probably find that the error leaps off the screen at you and you don't need to send it anyway. -- David Cantrell | Bourgeois reactionary pig There is no one true indentation style, But if there were K&R would be Its Prophets. Peace be upon Their Holy Beards.
participants (5)
-
David Cantrell -
David Precious -
gvim -
Niels Larsen -
Stefan Hornburg (Racke)