Skip Menu |

This queue is for tickets about the JavaScript CPAN distribution.

Report information
The Basics
Id: 46356
Status: new
Priority: 0/
Queue: JavaScript

People
Owner: Nobody in particular
Requestors: zhurs [...] ya.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.12
Fixed in: (no value)



Subject: Emptified arrays in arguments of function call
When I pass perl array to javascript function as argument, it become empty after call. % perl -e 'use JavaScript; use Data::Dumper; my $cx = JavaScript::Runtime->new()->create_context(); $cx->eval(qq!function f1(arr) {}!); my $arr = [1,2]; $cx->call("f1", $arr); print Dumper $arr' $VAR1 = []; Attached patch fixed this issue in my case.
Subject: arg_array.patch
--- libjavascript-perl-1.12.orig/PJS_TypeConversion.c +++ libjavascript-perl-1.12/PJS_TypeConversion.c @@ -208,7 +208,7 @@ av_length = av_len(av); for(cnt = 0; cnt <= av_length; cnt++) { jsval value; - if (PJS_ConvertPerlToJSType(cx, seen, obj, av_shift(av), &value) == JS_FALSE) { + if (PJS_ConvertPerlToJSType(cx, seen, obj, *(av_fetch(av, cnt, 0)), &value) == JS_FALSE) { *rval = JSVAL_VOID; return JS_FALSE; }