+
Point of view
All features
class PERL
Summary
This class allows to have an embedded Perl interpreter in your program. With this interpreter, you can "execute" any line as you would do in a Perl script, even lines such as "use strict;" or "use somepackage", lines with "require" (in perlfunc) and "do" (in perlfunc to include external Perl files). See tutorial/perl for examples.
The compilation process needs perl developpement to be installed (libperl-dev package on Debian). Compile options for the C compiler are determined with command 'perl -MExtUtils::Embed -e ccopts' and linker option with command 'perl -MExtUtils::Embed -e ldopts' Perl 5.6.0 or above is required.
Note that current release does not allow to have multiple interpreters running, so this class is a singleton. If you need multiple interpreters, documentation is available in manual perlembed (provided in standard Perl documentation and available on the net). Please contribute and send your changes!
Direct parents
Insert list: SINGLETON
Class invariant
Overview
Creation features
{ANY}
Features
{}
{ANY}
Perl code execution
{ANY}
  • instruction (command: STRING)
    command is evaluated as an instruction (no result).
  • expression (command: STRING)
    command is evaluated and the result is reachable with last_* functions.
Reading values from Perl
{ANY}
{}
{ANY}
  • is_equal (other: PERL): BOOLEAN
    Is other attached to an object considered equal to current object?
{}
make
effective procedure
{}
interpreter_started: BOOLEAN
writable attribute
{ANY}
destroy
effective procedure
{ANY}
instruction (command: STRING)
effective procedure
{ANY}
command is evaluated as an instruction (no result).
See also expression.
require
expression (command: STRING)
effective procedure
{ANY}
command is evaluated and the result is reachable with last_* functions.
See also read_variable, instruction, last_integer, last_real, last_string...
require
existant_variable (variable_name: STRING): BOOLEAN
effective function
{ANY}
Check if some Perl variable with the name variable_name does exist.
It's not related to the undef Perl value.
See also defined_variable, read_variable.
require
defined_variable (variable_name: STRING): BOOLEAN
effective function
{ANY}
Returns True if the Perl variable with the name variable_name does not have the Perl undef value.
require
read_variable (variable_name: STRING)
effective procedure
{ANY}
Read the Perl variable with name variable_name.
The result is available with last_* functions.
See also: last_integer, last_real, last_string...
require
last_result_is_integer: BOOLEAN
effective function
{ANY}
True if the result of the last interpreted expression or read variable is of integer type.
require
last_integer: INTEGER_32
effective function
{ANY}
Access to the result of the last interpreted expression or read variable when it is of integer type.
last_result: POINTER
writable attribute
{}
start_perl_interpreter
{}
eval_command (string: POINTER, boolean: BOOLEAN)
{}
eval_expression (string: POINTER, boolean: BOOLEAN): POINTER
{}
return type is SV*
sv_ok (sv_star: POINTER): INTEGER_32
{}
get_sv (string: POINTER, boolean: BOOLEAN): POINTER
{}
return type is SV*
sv_is_int (sv_star: POINTER): INTEGER_32
{}
sv_to_int (sv_star: POINTER): INTEGER_32
{}
perl_interpreter_destroy
{}
is_equal (other: PERL): BOOLEAN
effective function
{ANY}
Is other attached to an object considered equal to current object?
require
  • other /= Void
ensure
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)
is_real_singleton: BOOLEAN
effective function
{}
ensure
  • assertion_check_only: Result
singleton_memory_pool: HASHED_DICTIONARY[POINTER, STRING]
once function
{}
This pool is unique in the whole system.
A memory is kept for each singleton type (type, not class) in the system.
current_is_not_an_expanded_type: BOOLEAN
effective function
{}
Check that the dynamic type of the SINGLETON is not an expanded type.