Created
April 12, 2017 22:09
-
-
Save srikanthjeeva/dc5e4468f8b3ebd17401ac8a23138b71 to your computer and use it in GitHub Desktop.
How to return Boolean values from Perl dancer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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