Skip to content

Instantly share code, notes, and snippets.

@srikanthjeeva
Created April 12, 2017 22:09
Show Gist options
  • Save srikanthjeeva/dc5e4468f8b3ebd17401ac8a23138b71 to your computer and use it in GitHub Desktop.
Save srikanthjeeva/dc5e4468f8b3ebd17401ac8a23138b71 to your computer and use it in GitHub Desktop.
How to return Boolean values from Perl dancer
# perl dancer includes JSON::XS
# so returning JSON::XS:
# to return true, JSON::XS::true
get '/works' => {
return to_json {success => JSON::XS::true};
}
Response:
---------
{
"success": true
}
# to return false, JSON::XS::false
get '/works' => {
return to_json {success => JSON::XS::false};
}
Response:
---------
{
"success": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment