Subject: | Possible bug?? -- true/false handling in JSON-1.11 |
Date: | Thu, 26 Apr 2007 14:24:58 -0700 |
To: | bug-JSON [...] rt.cpan.org |
From: | George Lee <glee [...] kuchbi.com> |
Trying to use your perl module to talk to a java servlet. The servlet
returns:
{"readAllowed":true}
but that seems to turn into false on my end. Is this a bug or am I
doing the wrong thing. The JSON::NotString with value true keeps
evaluating as false in a boolean context.
my $http_resp = $ua->get ($url);
my $json_data = $http_resp->content();
$r->log_error (Dumper($json_data));
$r->log_error ("parsing response");
my $rdata = jsonToObj($json_data);
my %data = %$rdata;
if (ref ($data{readAllowed})) {
$r->log_error ("Is a reference -- " . ref ($data{readAllowed}) .
" with value " . $data{readAllowed});
}
if ($data{readAllowed}) {
return Apache2::Const::OK;
} else {
return Apache2::Const::FORBIDDEN;
}
When I run this I get this output
[Thu Apr 26 14:09:06 2007] [error] $VAR1 = '{"readAllowed":true}';\n
[Thu Apr 26 14:09:06 2007] [error] parsing response
[Thu Apr 26 14:09:06 2007] [error] Is a reference -- JSON::NotString
with value true
[Thu Apr 26 14:09:06 2007] [error] [client 0.0.0.0] client denied by
server configuration: D:/kuchbi/views/trunk/groupfile/3/img_27795.jpg
thanks!