[dancer-users] Serializer for Dancer2

Matthew Mallard matt at Q-Technologies.com.au
Sat Dec 20 20:37:02 GMT 2014


> That said, your error implies that you are not returning a hash or array reference from your route? Have you tried dumping your return value to check?

I think the thing that confuses me the most is that this is happening out of the box with the generated app, does this happen for anyone else?  If it’s unique to me, then there must be something funny about my environment.  Can someone else test this on latest Dancer2:

 dancer2 -a MyApp && cd MyApp
 add the line serializer: "JSON" to config.yml
 plackup ./bin/app.pl -p 5000 -I lib
 load page in browser or cURL:

curl -v http://localhost:5000/
* About to connect() to localhost port 5000 (#0)
*   Trying ::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 5000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:5000
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Sat, 20 Dec 2014 20:30:43 GMT
< Server: HTTP::Server::PSGI
< Server: Perl Dancer2 0.157000
< Content-Type: text/html
< Content-Length: 0
<
* Closing connection #0

(log from placket console)

HTTP::Server::PSGI: Accepting connections at http://0:5000/
[MyApp:106928] core @2014-12-21 07:21:40> looking for get / in /perf/perl/lib/perl5/Plack/Middleware/RemoveRedundantBody.pm l. 14
[MyApp:106928] core @2014-12-21 07:21:40> Entering hook core.app.before_request in /perf/perl/lib/perl5/Dancer2/Core/App.pm l. 1232
[MyApp:106928] core @2014-12-21 07:21:40> Failed to serialize the request: hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /perf/perl/lib/perl5/JSON.pm line 154. in (eval 219) l. 2
[MyApp:106928] core @2014-12-21 07:21:40> Entering hook core.app.after_request in /perf/perl/lib/perl5/Dancer2/Core/App.pm l. 1189
192.168.128.1 - - [21/Dec/2014:07:21:40 +1100] "GET / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:34.0) Gecko/20100101 Firefox/34.0”
[MyApp:106928] core @2014-12-21 07:30:43> looking for get / in /perf/perl/lib/perl5/Plack/Middleware/RemoveRedundantBody.pm l. 14
[MyApp:106928] core @2014-12-21 07:30:43> Entering hook core.app.before_request in /perf/perl/lib/perl5/Dancer2/Core/App.pm l. 1232
[MyApp:106928] core @2014-12-21 07:30:43> Failed to serialize the request: hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /perf/perl/lib/perl5/JSON.pm line 154. in (eval 219) l. 2
[MyApp:106928] core @2014-12-21 07:30:43> Entering hook core.app.after_request in /perf/perl/lib/perl5/Dancer2/Core/App.pm l. 1189
127.0.0.1 - - [21/Dec/2014:07:30:43 +1100] "GET / HTTP/1.1" 200 0 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2”

Matt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20141221/d2ef9d55/attachment.html>


More information about the dancer-users mailing list