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