NAME

Sidef::Types::Perl::Perl

DESCRIPTION

This class implements support for evaluating arbitrary Perl code inside a Sidef script.

The result is implicitly converted into a Sidef data structure.

SYNOPSIS

var obj = Perl('my $x = 42; sqrt($x)')
var res = obj.eval

METHODS

code

obj.code

Returns the Perl code as a String object.

new

var obj = Perl(perl_code)

Builds and returns a new Perl object, given a string that contains Perl code.

numeric_version

Perl.numeric_version

Returns the version of Perl as a Number object (e.g.: 5.036).

run

obj.run
Perl.eval(perl_code)

Evaluates the Perl code and returns a Sidef data structure.

Aliases: eval, execute

tie

Perl.tie(variable, class_name, *args)

Binds a variable to a package class and returns the result as an object.

Example:

require('DB_File')
var h = Hash()   # variable of HASH type
var o = Perl.tie(h, "DB_File", "file.db", File.O_RDWR | File.O_CREAT, 0666, %perl<$DB_File::DB_HASH>)
h{"foo"} = "bar"
o.sync

to_s

obj.to_s

Dumps the Perl object as a String object.

Aliases: dump, to_str

to_sidef

Perl.to_sidef(perl_structure)

Converts a given a Perl data structure into a Sidef data structure.

untie

Perl.untie(variable)

Unbinds a tied variable.

version

Perl.version

Returns the version of Perl as String object (e.g.: "v5.36.0").