# perl.begin

Starts a perl code snippet

Usage

    perl.begin [-n] [-q] [(<perl_context>[,<arg0>[,<arg1>[...]]])]
    <perl code>
    perl.end

Description

Indicates the beginning of a snippet of perl code. The whole code part between perl.begin and perl.end is executed in a perl interpreter. If perl.end is omitted then it is implicitly assumed that the code from perl.begin to the end of the command buffer is perl.
Each perl code execution is bound to a perl context (that is in fact a particular instance of a perl interpreter). If <perl_context> is not specified or it is an empty string then temporary perl interpreter is created and destroyed just after the code snippet has terminated execution. If <perl_context> is specified then a perl interpreter keyed to that context is used: if it was already existing then it is reused otherwise it is created. Any <perl_context> is persistent: it mantains the function declarations and perl variable states until explicitly destroyed with perl.destroy (or the perlcore module is forcibly unloaded).
The <arg0>,<arg1>,... arguments, if present, are passed to the perl code snippet in the @_ array (accessible as $_[0],$_[1]...).
The return value of the perl code is propagated to the current context (just like setreturn was called on it) unless the -n switch is used.
The -q switch prevents from the command from printing any warning.
See the perl scripting documentation for more information.

Switches

-q | --quiet
Prevents the command from printing any warnings.
-n | --no-return
Prevents the perl script return value to be propagated to the current context.
-f | --fail-on-error
Treat perl errors as KVS errors and abort execution of the current script. Incompatible with -q

Syntax Specification

    perl.begin [-n] [-q] [(<perl_context>[,<arg0>[,<arg1>[...]]])]
    <perl code>
    perl.end

Examples

        perl.begin
        KVIrc::eval("echo \"Hello World from perl!\"");
        perl.end

Index, Commands

KVIrc 4.0.2.4740 Documentation
Generated by root at Tue Feb 1 06:16:04 2011