sukria/Dancer — pull request #677 by ironcamel (2011-10-16 05:53:36+00:00)
Title: Adding http_error syntax sugar.

I added a http_error keyword that lets you set the error status and body of the response in one go.

post '/user/:id' => sub {
return http_error 400 => 'name param is required' unless param 'name';
...
}

The above is equivalent to:

post '/user/:id' => sub {
if (not param 'name') {
status 400;
return 'name param is required';
}
...
}