This plugins automatically install the following services in the global object of every context created in the referenced runtime.
To use any of the methods marked as Restricted you must call in a unrestricted context, otherwise the method invocation throws an error.
- Sys Object
Alias to the global object, so if in a different scope you need to reference any of the following services, you can use
Sys.as a prefix. Think in the
windowobject when in the browser.
- Env Object
The environment variables under which your program is running. You can change the properties on this object to modify the environment.
This object is an alias to perl's "%ENV" in perlvar.
- IO Object
Used to aggregate all properties related to I/O
- IO.File ( FILENAME [,MODE [, PERMS]] ) Constructor Function
- IO.File.new_tmpfile ( ) Function
Returns a new instance of a IO::File opened for read/write on a newly created temporary file. On systems where this is possible, the temporary file is anonymous (i.e. it is unlinked after creation, but held open).
- print ( STRING [, ... ]) Function
Write to STDOUT. Alias to "print" in perlfunc.
- say ( STRING [, ...]) Function
- sprintf ( FORMAT, LIST ); Function
Returns a string formatted by the usual "printf" conventions of the C library function "sprintf". This is implemented by "sprintf" in perlfunc.
- peval ( STRING ) Function Restricted
Perl eval. Eval the STRING as perl code using "eval" in perlfunc. Returns the value of the last statement in STRING. If perl's eval fails, throws an exception.
- system ( COMMAND [, ARG1 [, ... ]] ) Function Restricted
Alias for perl's "system" in perlfunc.
- caller Function
Alias for perl's "caller" in perlfunc.
- include ( FILENAME ) Function
- require ( BIND, PACKAGE [, CONSTRUCTOR] ) Function Restricted
BIND. The value bound will be either a
PerlSubif a constructor was found in the perl package or a
Stashotherwise. You must read the discussion on "install" in JSPL::Controller.
Example, requiring a package with a constructor:
require('INET', 'IO::Socket::INET'); // INET instanceOf PerlSub === true var conn = new INET(...);
Stashis bound it can be used to call class methods on it, among other things.
Example, requiring a package without a constructor:
require('DBI', 'DBI'); var conn = DBI.connect(...);
- load ( MODULE [, ... ]) Function Restricted
The require service described above is actually implemented in terms of two lower-level services: load and install.
The load service makes the given list of perl libraries to be loaded in the perl side. The return value of load is the number of modules loaded. If a module fails to load an exception will be thrown.
- install ( BIND, PACKAGE [, CONSTRUCTOR] ) Function
As discussed above,
requireis defined in terms of
install. Install makes a perl module to be available on the perl side. The module should be previously been loaded using "load". You should read the discussion on "install" in JSPL::Controller.
Separating the "load" and the
- warn ( STRING [, ... ]) Function
Emit a warning message to STDERR. Alias to "warn" in perlfunc.