will first create an object with the name document (unless it exists already) and then define a property named form to it, which is an object of type Array. Therefore, in the JS code, you're going to be able define things like

Binds a Perl function provided as a coderef ($funcref) to a newly created JS function named $name in JS land. It's a real function (therefore bound to the global object) if $obj is omitted. However, if $obj is ref to a JS object (retrieved via $js->object_by_path($path) or the like), the function will be a method of the specified object.

(Note that you *can* untar the SpiderMonkey distribution elsewhere, but, if so, then you need to edit the setting of $JSLIBPATH in Makefile.PL).

Next, you need to copy the shared library file thus constructed (e.g., libjs.so or js32.dll) to an appropriate directory on your library path. On Windows, this can also be the directory where the perl executable lives. On Unix, this has been shown to work without copying, but this way you need to keep the compiled binary in the js build directory forever. Copying js/src/Your_OS_DBG.OBJ/libjs.so to /usr/local/lib and making sure that /usr/local/lib is in your LD_LIBRARY_PATH seems to be safest bet.

Now, build JavaScript::SpiderMonkey in the standard way:

cd JavaScript-SpiderMonkey-v.vv
perl Makefile.PL
make
make test
make install