Subject: | Running example app result in StackTrace |
Running the example in the SYNOPSIS result in no response and the
following StackTrace:
Trace begun at
/tmp/makholm/perl/lib/perl5/Plack/Middleware/StackTrace.pm line 22
Plack::Middleware::StackTrace::__ANON__('body must be bytes and
should not contain wide characters (UTF-8 strings). at
/tmp/makholm/perl/lib/perl5/Plack/Middleware/StackTrace.pm line 27^J')
called at /usr/share/perl/5.10/Carp.pm line 44
Carp::croak('body must be bytes and should not contain wide
characters (UTF-8 strings).') called at
/tmp/makholm/perl/lib/perl5/Plack/Middleware/Lint.pm line 119
Plack::Middleware::Lint::validate_res('Plack::Middleware::Lint=HASH(0x16
49370)', 'ARRAY(0x24926c8)') called at
/tmp/makholm/perl/lib/perl5/Plack/Middleware/Lint.pm line 25
Plack::Middleware::Lint::call('Plack::Middleware::Lint=HASH(0x1649370)',
'HASH(0x21c5798)') called at
/tmp/makholm/perl/lib/perl5/Plack/Component.pm line 39
Plack::Component::__ANON__('HASH(0x21c5798)') called at
/tmp/makholm/perl/lib/perl5/Plack/Middleware/StackTrace.pm line 27
Plack::Middleware::StackTrace::__ANON__ at
/usr/share/perl5/Try/Tiny.pm line 71
eval {...} at /usr/share/perl5/Try/Tiny.pm line 67
Try::Tiny::try('CODE(0x21eaa48)',
'Try::Tiny::Catch=REF(0x2291568)') called at
/tmp/makholm/perl/lib/perl5/Plack/Middleware/StackTrace.pm line 27
Plack::Middleware::StackTrace::call('Plack::Middleware::StackTrace=HASH(
0x2291088)', 'HASH(0x21c5798)') called at
/tmp/makholm/perl/lib/perl5/Plack/Component.pm line 39
Plack::Component::__ANON__('HASH(0x21c5798)') called at
/tmp/makholm/perl/lib/perl5/Plack/Middleware/AccessLog.pm line 21
Plack::Middleware::AccessLog::call('Plack::Middleware::AccessLog=HASH(0x
228d888)', 'HASH(0x21c5798)') called at
/tmp/makholm/perl/lib/perl5/Plack/Component.pm line 39
Plack::Component::__ANON__('HASH(0x21c5798)') called at
/tmp/makholm/perl/lib/perl5/Plack/Middleware/ContentLength.pm line 10
Plack::Middleware::ContentLength::call('Plack::Middleware::ContentLength
=HASH(0x2291880)', 'HASH(0x21c5798)') called at
/tmp/makholm/perl/lib/perl5/Plack/Component.pm line 39
Plack::Component::__ANON__('HASH(0x21c5798)') called at
/tmp/makholm/perl/lib/perl5/Plack/Util.pm line 134
eval {...} at /tmp/makholm/perl/lib/perl5/Plack/Util.pm line 134
Plack::Util::run_app('CODE(0x22d54a0)', 'HASH(0x21c5798)')
called at /tmp/makholm/perl/lib/perl5/HTTP/Server/PSGI.pm line 144
HTTP::Server::PSGI::handle_connection('HTTP::Server::PSGI=HASH(0x22983c0
)', 'HASH(0x21c5798)', 'IO::Socket::INET=GLOB(0x21cf800)',
'CODE(0x22d54a0)') called at
/tmp/makholm/perl/lib/perl5/HTTP/Server/PSGI.pm line 105
HTTP::Server::PSGI::accept_loop('HTTP::Server::PSGI=HASH(0x22983c0)',
'CODE(0x2297e80)') called at
/tmp/makholm/perl/lib/perl5/HTTP/Server/PSGI.pm line 59
HTTP::Server::PSGI::run('HTTP::Server::PSGI=HASH(0x22983c0)',
'CODE(0x2297e80)') called at
/tmp/makholm/perl/lib/perl5/Plack/Handler/HTTP/Server/PSGI.pm line 14
Plack::Handler::HTTP::Server::PSGI::run('Plack::Handler::Standalone=HASH
(0x1bc56d8)', 'CODE(0x2297e80)') called at
/tmp/makholm/perl/lib/perl5/Plack/Loader.pm line 83
Plack::Loader::run('Plack::Loader=HASH(0x1401118)',
'Plack::Handler::Standalone=HASH(0x1bc56d8)') called at
/tmp/makholm/perl/lib/perl5/Plack/Runner.pm line 248
Plack::Runner::run('Plack::Runner=HASH(0x12ca760)') called at
/tmp/makholm/perl/bin/plackup line 10
127.0.0.1 - - [30/Jun/2010 16:13:19] "GET /?
method=sum;id=1;params=[2,3,5] HTTP/1.1" 500 3250 "-" "lwp-request/5.834
libwww-perl/5.836"
Explicitly setting PLACK_ENV to something different from 'development'
removes the stacktrace and gives the right response. Adding a call to
Encode::encode_utf8 to line 394 works too. This way line 394 would like
like
$response->body(Encode::encode_utf8( $json ));
instead of
$response->body($json);