The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

jsp - JavaScript interpreter with perl powers

Synopsis

An example say more than a thousands words:

     #!/usr/bin/jsp
     // Load some modules
     require('Gtk2', 'Gtk2');
     install('Gtk2.Window', 'Gtk2::Window');
     install('Gtk2.Button', 'Gtk2::Button');
    
     Gtk2.init();
    
     var window = new Gtk2.Window('toplevel');
     var button = new Gtk2.Button('Quit');
    
     button.signal_connect('clicked', function() { Gtk2.main_quit() });
     window.add(button);
     window.show_all();
    
     Gtk2.main();
     say('Thats all folks!');

Description

This provides a SpiderMonkey based javascript shell extended by perl, thanks to JSP perl module.

Usage

    $jsp [--shell] [--help] [<file>]

jsp can be used either in interactive or script execution modes. The script to be executed can be passed on the command line as file above or jsp can be used in the she-bang line of your script.

    #!/usr/bin/jsp
    <Lot of javascript code>
    

Options

You can use any of the following

--shell

Start an interactive JS shell

--help

Print usage help

<file>

Optional. Run a script from the given file.

If not file given, its starts in interactive mode.

JavaScript extensions

Your script should be written in javascript syntax and has available all features of the SpiderMonkey engine, see https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference

Also jsp provides all the services documented in JSP::Runtime::Stock plus the following:

Argv PerlArray

Array of arguments passed to your script on the command line. Available only in non interactive mode.

This array is an alias to perl's @ARGV.

quit () PerlSub

Exit from the interactive shell

PrgName string

String with the name of the file running, available only in non interactive mode.

version string

This is a string describing the shell version. It has the form "JSP version <version>".

Author

Salvador Ortiz <sortiz@cpan.org>

License and copyright

Copyright (c) 2008 - 2010, Salvador Ortiz <sortiz@cpan.org>

Disclaimer of warranty

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING. THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.