Last active
August 29, 2015 14:19
-
-
Save tildedave/52f9c9ac12521c99ef38 to your computer and use it in GitHub Desktop.
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
use JavaScript::V8; | |
use JSON; | |
my $v8context = JavaScript::V8::Context->new(); | |
$v8context->bind(f => JSON::false); | |
my $res = $v8context->eval('(function() { return (f ? 1 : 0) })()'); | |
print "$res\n"; | |
# returns 1, because JSON::false is bound to the empty object and so truthy | |
my $res = $v8context->eval('typeof f'); | |
print "$res\n"; | |
# prints 'object', not 'boolean' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment