SPVM::BlessedObject::Array - Array based blessed object
SPVM::BlessedObject::Array is array based blessed object.
This object contains SPVM array object.
# 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;
my $value = $spvm_nums->get(2);
Get the value of a array element.
$spvm_nums->set(2 => 5);
Set the value of a array element
my $nums = $spvm_nums->to_elems;
Convert SPVM array to Perl array reference.
my $binary = $spvm_nums->to_bin;
Convert SPVM array to binary data.
Binary data is unpacked by unpack function.
unpack
An exmaple when array is int array:
my @nums = unpack 'l*', $binary;
SPVM::BlessedObject::Array overloads the following operators.
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};
To install SPVM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM
CPAN shell
perl -MCPAN -e shell install SPVM
For more information on module installation, please visit the detailed CPAN module installation guide.