NAME

SPVM::Document::PerlAPI - SPVM Perl API

What is SPVM Perl API

SPVM Perl API is the API to convert Perl data to SPVM data, and SPVM data to Perl data.

This api is Perl function called from Perl script.

use SPVM;

# Create SVPM int array
my $spvm_nums = SPVM::new_int_array([1, 2, 3]);

# Convert to perl array reference
my $nums = $spvm_nums->to_elements;

Functions

new_byte_array

Create byte array.

my $array = SPVM::new_byte_array([1, 2, 3]);

If you get perl values, you can use get_elements methods.

my $values = $array->get_elements;

new_byte_array_string

Create byte array from decoded Perl string.

my $array = SPVM::new_byte_array_string("����������");

new_short_array

Create short array

my $array = SPVM::new_short_array([1, 2, 3]);

If you get perl values, you can use get_elements methods.

my $values = $array->get_elements;

new_int_array

Create int array

my $array = SPVM::new_int_array([1, 2, 3]);

If you get perl values, you can use get_elements methods.

my $values = $array->get_elements;

new_long_array

Create long array

my $array = SPVM::new_long_array([1, 2, 3]);

If you get perl values, you can use get_elements methods.

my $values = $array->get_elements;

new_float_array

Create float array

my $array = SPVM::new_float_array([1, 2, 3]);

If you get perl values, you can use get_elements methods.

my $values = $array->get_elements;

new_double_array

Create double array

my $array = SPVM::new_double_array([1, 2, 3]);

If you get perl values, you can use get_elements methods.

my $values = $array->get_elements;

new_object_array_len

Create object array with type name and length.

my $array = SPVM::new_object_array_len("int[]", 3);

You can set and get elements by set and get method.

$array->set(1, SPVM::new_int_array([1, 2, 3]));
my $element = $array->get(1);

new_object

Create object.

my $object = SPVM::new_object("Point");

You can set and get value by set and get method.

$object->set(x => 1);
my $x = $object->get('x');

SPVM::Data::Array

  • new_len

  • set_elements

  • set_bin

  • set_string

  • set_element

  • get_element

  • to_elements

  • to_bin

  • to_string