NAME

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

DESCRIPTION

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

This object contains SPVM array object.

SYNOPSYS

# 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};