Skip Menu |

This queue is for tickets about the JavaScript-SpiderMonkey CPAN distribution.

Report information
The Basics
Id: 6504
Status: open
Priority: 0/
Queue: JavaScript-SpiderMonkey

People
Owner: Nobody in particular
Requestors: oykug [...] sbt.com.tr
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.08
Fixed in: (no value)



Subject: returning arrays from perl mapped funbctions to javascript context
It seems like it is not possible to return arrays to mapped functions in javascript such as sub js_state_list { my @states = ...... return @states; } {bind js_state_list in perl to state_list function} (in js) var s = state_list(); .. use s as a js_array in the javascript code...
On Thu Jun 03 18:46:46 2004, guest wrote: Show quoted text
> It seems like it is not possible to return arrays to mapped functions > in javascript such as > > sub js_state_list { > my @states = ...... > return @states; > } > > {bind js_state_list in perl to state_list function} > > (in js) > var s = state_list(); > .. use s as a js_array in the javascript code...
Well, one possible solution to returning arbitrarily complex Perl data structures back to JS land is as follows: * firstly, use Perl's JSON::Syck to dump the Perl data structures to JSON strings * Secondly, evaluate the JSON strings as JS code and assign the resulting JS values to JS temporary variables * set the temp var as the Perl callbacks' returned values Yeah, I know there's still a good amount of XS/Perl code to write, but I believe it's not difficult at all. Cheers