Name

SPVM::BlessedObject::Array - Array based blessed object

DESCRIPTION

SPVM::BlessedObject::Array is array based blessed object.

This object contains SPVM array object.

Usage

# Get the value of a array element
my $value = $spvm_nums->get(2);

# Set the value of a array element
$spvm_nums->set(2 => 5);

# Convert SPVM array to Perl array reference
my $nums = $spvm_nums->to_elems;

# Convert SPVM array to Perl binary data
my $binary = $spvm_nums->to_bin;

Methods

get

my $value = $spvm_nums->get(2);

Get the value of a array element.

set

$spvm_nums->set(2 => 5);

Set the value of a array element

to_elems

my $nums = $spvm_nums->to_elems;

Convert SPVM array to Perl array reference.

to_bin

my $binary = $spvm_nums->to_bin;

Convert SPVM array to binary data.

Binary data is unpacked by unpack function.

An exmaple when array is int array:

my @nums = unpack 'l*', $binary;

Operators

SPVM::BlessedObject::Array overloads the following operators.

array dereference

Array dereference get the elements of the array.

# Get elements
my @elements = @$array;

This is the same as the following.

my @elements = @{$array->to_elems};