[dancer-users] "halt" not setting content-type?

Aaron Hall ahall at vitaphone.net
Sun Feb 3 03:53:09 GMT 2013

Dancer 1.3110, Perl 5.10.1 (Debian stable), Apache 2.2.16, mod_fastcgi.

When I call from a route:

     halt $some_html;

I'm getting back the unrendered HTML as text/plain, not text/html. This
only happens when I'm using mod_fastcgi (with FastCgiExternalServer).
When I just run "./app.pl", I get my rendered text/html. When I run
"plackup ./app.pl", I get text/html. This only happens from "halt". If I
use "return", I get text/html. Am I doing something wrong?

I did try looking through the Dancer source to see how this works. I am
over my head at this point (not a programmer by trade), but I wonder if
perhaps "halt" isn't setting the content-type on the response object it
creates. I manually created a Dancer::Response object and called
$response->content_type("text/html") on it, passed that to "halt", and
got text/html. Of course, none of that explains why FastCGI does one
thing and the built-in server does something else.

I'm working around it by creating my own Dancer::Response objects. Is
that what I should be doing?

Thanks very much,

Aaron Hall           :        I claim this planet in the name of Mars.
ahall at vitaphone.net  :        Hmmm, isn't that lovely?

More information about the dancer-users mailing list