Skip Menu |

This queue is for tickets about the JavaScript CPAN distribution.

Report information
The Basics
Id: 1896
Status: resolved
Priority: 0/
Queue: JavaScript

Owner: Nobody in particular
Requestors: redstar [...]

Bug Information
Severity: Important
Broken in: 0.52
Fixed in:
  • 0.55
  • 1.00


Subject: Javascript boolean return values are not converted
Download (untitled) / with headers
text/plain 460b
The last statement of the javascript code should be returned to Perl, but if the type of the last statement is boolean, this does not work. A common example is when the last statement is a comparison like "1 == 1". Intuitively, this should return true, or 1, to Perl, but it returns undef. The problem is that the case of boolean return values is not taken care of in the XSUB wrapper JavaScript.xs, but I have included a patch file which solves the problem.
Download javascript.diff
text/x-diff 437b
*** JavaScript.xs.err Sun Dec 29 05:39:33 2002 --- JavaScript.xs Sun Dec 29 05:38:49 2002 *************** *** 878,883 **** --- 878,885 ---- sv_setnv(*sv, *JSVAL_TO_DOUBLE(v)); } else if(JSVAL_IS_STRING(v)){ sv_setpv(*sv, JS_GetStringBytes(JSVAL_TO_STRING(v))); + } else if(JSVAL_IS_BOOLEAN(v)){ + sv_setiv(*sv, JSVAL_TO_BOOLEAN(v)); } else { warn("Unknown primitive type");

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to