Functions are exported on request, or may be called fully qualified.
- The script
This script may safely contain newlines, unicode characters, comments etc. Any line numbers in error messages should match up with error messages
- Return value
safari_jswill return the empty list. If you return nothing (i.e. use
return;in your script),
JSON.stringifyfunction and decoded on the Perl side using the JSON::XS module.
undef, JSON::XS::true (which you can treat like the scalar
1) and JSON::XS::false (which you can treat like the scalar
0) respectivly. Please see JSON::XS for more information.
- Passing Parameters
You may pass in named parameters by passing them as name/value pairs
safari_js $js_code_to_run, name1 => $value1, name2 => $value2, ...
The parameters are simply availble as variables in your code.
- Exception Handling
safari_js. This will stringify to the exception you normally would see in your browser and can be integated for extra info such as the line number, etc.
Written by Mark Fowler <firstname.lastname@example.org>
Copryright Mark Fowler 2011. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Some pages (e.g. http://developer.apple.com/) cause array stringifcation to break. I haven't worked out why yet.