Closed scotticles closed 11 years ago
Thanks for the report, I'll look into it over the weekend. It would be really helpful if you could create a gist with your config files and the app that is causing the problem.
At first glance it appears to be a conflict between Dancer's version of from_json
and JSON.pm's version of from_json
. So I'm guessing you have a line like use JSON;
in your application. If you change this to use JSON qw();
to prevent it from exporting it's own from_json
function - then things should work.
In any case, I'll have a fix in the next few days
never made a gist before that was cool. https://gist.github.com/scottscreations/66c93e9b8b22f3e20a75
i tried adding the use JSON qw(); on my main pm but no go. I am not using use JSON in any of my stuff.
I am loading these though for my model pms that work with the database. use Dancer ':script'; use Mouse; use Dancer::Plugin::Database; use Digest::MD5 'md5_base64';
I appreciate the help.
Sorry for the slow reply.
In the end, I couldn't replicate your problems. I tried with different versions of MySQL, using your config file (including the auto_reload
section), even with generating a simple test app that created a session, destroyed it, then redirecting - I couldn't see any issue at all.
This combined with the fact the Travis CI build is passing too, means I'm working blind.
So what I've done is improved the error handling slightly as part of #5. Now it doesn't rely on JSON.pm failing gracefully in order to check or destroy a session, and it won't issue a warning when a session can't be found or destroyed.
So, could you please test the Latest v1.2.1 version and let me know how that goes?
If not, could you be so kind to provide a simple dancer app that replicates the problem so I might be able to actually see it?
using the latest 1.1.0 and my dancer is 1.311
I followed the markdown using the YAML method for setting it up.
What i do is my dancer will load my app just fine, i can sign in. My session shows up in the sessions table and then when i go to logout. It works but i redirect it to my login and it gets this error on all my pages. If i remove my cookies and clear the sessions table its okay again....What can i do to help solve this? I can send a sample of my config.yaml and my routes on what it looks like. I am a little rusty with perl else i would try and help fix it.
Error 500
runtime error
Warning caught during route execution: Use of uninitialized value $_[0] in string eq at /home/scott/perl5/lib/perl5/JSON.pm line 159. /home/scott/perl5/lib/perl5/JSON.pm around line 159 156 157 158 sub fromjson ($@) { 159 if ( ref($[0]) eq 'JSON' or $_[0] eq 'JSON' ) { 160 Carp::croak "from_json should not be called as a method."; 161 } 162 my $json = new JSON;