SPVM::ExchangeAPI - SPVM Exchange API
SPVM::ExchangeAPI is APIs to convert Perl data structures to/from SPVM data structures, and to call SPVM methods from Perl.
SPVM::ExchangeAPI
my $api = SPVM::ExchangeAPI->new(env => $env, stack => $stack); my $int_array = $api->new_int_array([1, 2, 3]);
Getting an global ExchangeAPI object:
ExchangeAPI
my $api = SPVM::api(); my $int_array = $api->new_int_array([1, 2, 3]);
my $env = $api->env;
Gets the execution environment.
my $stack = $api->stack;
Gets the call stack.
my $api = SPVM::ExchangeAPI->new(env => $env, stack => $stack);
Creates a new SPVM::ExchangeAPI object.
Options:
env
An execution environment.
stack
An stack.
my $sp_nums = $api->new_byte_array([1, 2, 3]);
Converts a Perl numeric array reference to a SPVM::BlessedObject::Array object that has the value of the SPVM byte[] type and returns it.
byte[]
If the argument is undef, returns undef.
undef
my $sp_nums = $api->new_byte_array_len($length);
Create a new SPVM::BlessedObject::Array object that has the value of the SPVM byte[] type with the length.
The length must be greater than or equal to 0. Otherwise an exception will occur.
0
my $pl_binary = pack('c3', 97, 98, 99); my $sp_nums = $api->new_byte_array_from_bin($pl_binary);
Converts a Perl binary to a SPVM::BlessedObject::Array object that has the value of the SPVM byte[] type and returns it.
The Perl binary is interpreted as 8-bit signed integers. The length of the array is calcurated from the Perl binary.
Examples:
# Convert Perl string to SPVM byte[] my $pl_binary ="abc"; my $sp_nums = $api->new_byte_array_from_bin($pl_binary);
my $sp_nums = $api->new_byte_array_from_string("あいう");
The same as the "new_byte_array_from_bin" method. Any decoding is not performed.
my $sp_nums = $api->new_short_array([1, 2, 3]);
Converts a Perl numeric array reference to a SPVM::BlessedObject::Array object that has the value of the SPVM short[] type and returns it.
short[]
my $sp_nums = $api->new_short_array_len($length);
Create a new SPVM::BlessedObject::Array object that has the value of the SPVM short[] type with the length.
my $pl_binary = pack('c3', 97, 98, 99); my $sp_nums = $api->new_short_array_from_bin($pl_binary);
Converts a Perl binary to a SPVM::BlessedObject::Array object that has the value of the SPVM short[] type and returns it.
The Perl binary is interpreted as 16-bit signed integers. The length of the array is calcurated from the Perl binary.
my $sp_nums = $api->new_int_array([1, 2, 3]);
Converts a Perl numeric array reference to a SPVM::BlessedObject::Array object that has the value of the SPVM int[] type and returns it.
int[]
my $sp_nums = $api->new_int_array_len($length);
Create a new SPVM::BlessedObject::Array object that has the value of the SPVM int[] type with the length.
my $pl_binary = pack('l3', 97, 98, 99); my $sp_nums = $api->new_int_array_from_bin($pl_binary);
Converts a Perl binary to a SPVM::BlessedObject::Array object that has the value of the SPVM int[] type and returns it.
The Perl binary is interpreted as 32-bit signed integers. The length of the array is calcurated from the Perl binary.
my $sp_nums = $api->new_long_array([1, 2, 3]);
Converts a Perl numeric array reference to a SPVM::BlessedObject::Array object that has the value of the SPVM long[] type and returns it.
long[]
my $sp_nums = $api->new_long_array_len($length);
Create a new SPVM::BlessedObject::Array object that has the value of the SPVM long[] type with the length.
my $pl_binary = pack('q3', 97, 98, 99); my $sp_nums = $api->new_long_array_from_bin($pl_binary);
Converts a Perl binary to a SPVM::BlessedObject::Array object that has the value of the SPVM long[] type and returns it.
The Perl binary is interpreted as 64-bit signed integers. The length of the array is calcurated from the Perl binary.
my $sp_nums = $api->new_float_array([1.2, 2.5, 3.3]);
Converts a Perl numeric array reference to a SPVM::BlessedObject::Array object that has the value of the SPVM float[] type and returns it.
float[]
my $sp_nums = $api->new_float_array_len($length);
Create a new SPVM::BlessedObject::Array object that has the value of the SPVM float[] type with the length.
my $pl_binary = pack('f3', 0.5, 1.5, 2.5); my $sp_nums = $api->new_float_array_from_bin($pl_binary);
Converts a Perl binary to a SPVM::BlessedObject::Array object that has the value of the SPVM float[] type and returns it.
The Perl binary is interpreted as 32-bit floating point. The length of the array is calcurated from the Perl binary.
my $sp_nums = $api->new_double_array([1.2, 2.5, 3.3]);
Converts a Perl numeric array reference to a SPVM::BlessedObject::Array object that has the value of the SPVM double[] type and returns it.
double[]
my $sp_nums = $api->new_double_array_len($length);
Create a new SPVM::BlessedObject::Array object that has the value of the SPVM double[] type with the length.
my $pl_binary = pack('f3', 0.5, 1.5, 2.5); my $sp_double_array = $api->new_double_array_from_bin($pl_binary);
Converts a Perl binary to a SPVM::BlessedObject::Array object that has the value of the SPVM double[] type and returns it.
The Perl binary is interpreted as 64-bit floating point. The length of the array is calcurated from the Perl binary.
my $sp_string = $api->new_string("あいう");
Converts a Perl string to a SPVM::BlessedObject::String object. Any decoding is not performed.
my $pl_binary = pack('c3', 97, 98, 99); my $sp_string = $api->new_string_from_bin($pl_binary);
Converts a Perl binary to a SPVM::BlessedObject::String.
The Perl binary is interpreted as 8-bit signed integers. The length of the string is calcurated from the Perl binary.
my $byte_array = $api->new_any_object_array( [SPVM::Byte->new(1), SPVM::Byte>new(2), SPVM::Byte->new(3)] );
The alias for the following code using the "new_object_array" method.
my $sp_array = $api->new_object_array('object[]', $pl_array);
my $byte_array = $api->new_object_array( "SPVM::Byte[]", [SPVM::Byte->new(1), SPVM::Byte>new(2), SPVM::Byte->new(3)] );
Converts a Perl array reference to a SPVM SPVM::BlessedObject::Array object that has the value of a object array type and returns it.
The first argument is a SPVM array type name. If the type doesn't exist, an exception will occur.
The second argument is a Perl array reference. Each element must be a SPVM::BlessedObject object or undef. Otherwise an exception will occur.
my $object1 = $api->new_int_array([1, 2, 3]); my $object2 = $api->new_int_array([4, 5, 6]); my $objects = $api->new_object_array("int[][]",[$object1, $object2]);
Converts a Perl array reference to a SPVM::BlessedObject::Array object that has the value of a multi-numeric array type and returns it.
my $pl_values = [ {x => 0, y => 1, z => 2}, {x => 3, y => 4, z => 5}, {x => 6, y => 7, z => 8}, ]; my $sp_mulnum_array = $api->new_mulnum_array("TestCase::Point_3i[]", $pl_values);
The second argument is a Perl array of a hash references. Each hash reference must be contain all fields of the multi-numeric typee. Otherwise an exception will occur.
my $binary = pack('l9', (0, 1, 2), (3, 4, 5), (6, 7, 8)); my $sp_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3i[]", $binary);
Converts a Perl binary to a SPVM::BlessedObject::Array object that has the value of a multi-numeric array type and returns it.
The first argument is a multi-numeric array type of SPVM.
The second argument is a Perl binary. The length of the array is calcurated from the Perl binary.
# new_mulnum_array_from_bin - byte { my $binary = pack('c9', (0, 1, 2), (3, 4, 5), (6, 7, 8)); my $sp_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3b[]", $binary); } # new_mulnum_array_from_bin - short { my $binary = pack('s9', (0, 1, 2), (3, 4, 5), (6, 7, 8);; my $sp_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3s[]", $binary); } # new_mulnum_array_from_bin - int { my $binary = pack('l9', (0, 1, 2), (3, 4, 5), (6, 7, 8)); my $sp_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3i[]", $binary); } # new_mulnum_array_from_bin - long { my $binary = pack('q9', (0, 1, 2), (3, 4, 5), (6, 7, 8)); my $sp_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3l[]", $binary); } # new_mulnum_array_from_bin - float { my $binary = pack('f9', (0, 1, 2), (3, 4, 5), (6, 7, 8)); my $sp_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3f[]", $binary); } # new_mulnum_array_from_bin - double { my $binary = pack('d9', (0, 1, 2), (3, 4, 5), (6, 7, 8)); my $sp_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3d[]", $binary); }
my $exception = $api->get_exception();
Gets the exception in the current call stack as SPVM::BlessedObject::String object.
Sets an exception in the current call stack.
The argument must be a Perl string, a SPVM::BlessedObject::String object or undef. Otherwise an exception will occur.
$api->set_exception($api->new_string("abc")); $api->set_exception("abc"); $api->set_exception(undef);
my $count = $api->get_memory_blocks_count();
Gets the count of memory blocks on the execution environment.
# First Memory Blocks Count my $start_memory_blocks_count = $api->get_memory_blocks_count(); # Processing # ... # Last Memory Blocks Count my $end_memory_blocks_count = $api->get_memory_blocks_count(); unless ($end_memory_blocks_count == $start_memory_blocks_count) { die"Memroy leak"; }
# Call an class method my $ret = $api->call_method($class_name, $method_name, @args); # Call an instance method my $ret = $api->call_method($invocant, $method_name, @args);
Calls an class method or an instance method with arguments and return the return value.
If the count of arguments is less than the count of the arguments of the method, an exception will occur.
If the count of arguments is more than the count of the arguments of the method, an exception will occur.
The arguments are converted by the rule of "Argument Conversion".
The return value is converted by the rule of "Return Value Conversion".
# Class method call my $obj_int = $api->call_method("Int", "new", 1); # Instance method call $api->call_method($obj_int, "set_value", 5); my $value = $api->call_method($obj_int, "value");
my $class = $api->class('Int');
Creates a new SPVM::ExchangeAPI::Class object.
$api->class('Int')->new(1);
The arguments in the "call_method" are converted to the values of SPVM in the following rules.
If the SPVM argument type is byte, the following coversion is performed.
byte
A Perl scalar is converted to a value of the SPVM byte type using the SvIV perlapi and a type cast to int8_t in C Language.
int8_t
C Language
(int8_t)SvIV(perl_scalar)
If the SPVM argument type is short, the following coversion is performed.
short
A Perl scalar is converted to a value of the SPVM short type using the SvIV perlapi and a type cast to int16_t in C Language.
int16_t
(int16_t)SvIV(perl_scalar)
If the SPVM argument type is int, the following coversion is performed.
int
A Perl scalar is converted to a value of the SPVM int type using the SvIV perlapi and a type cast to int32_t in C Language.
int32_t
(int32_t)SvIV(perl_scalar)
If the SPVM argument type is long, the following coversion is performed.
long
A Perl scalar is converted to a value of the SPVM long type using the SvIV perlapi and a type cast to int64_t in C Language.
int64_t
(int64_t)SvIV(perl_scalar)
If the SPVM argument type is float, the following coversion is performed.
float
A Perl scalar is converted to a value of the SPVM float type using the SvNV perlapi and a type cast to float in C Language.
(float)SvNV(perl_scalar)
If the SPVM argument type is double, the following coversion is performed.
double
A Perl scalar is converted to a value of the SPVM double type using the SvNV perlapi and a type cast to double in C Language.
(double)SvNV(perl_scalar)
If the SPVM argument type is string, the Perl scalar is converted by the following rules.
string
If any of the following rules does not match, an exception will occur.
If the SPVM argument type is string, the Perl non-ref scalar is converted to SPVM::BlessedObject::String object.
The non-ref scalar value is assumed to a Perl decoded string, and is converted to UTF-8 bytes.
If the non-ref scalar value is Perl undef, it is converted to Perl undef.
And the following "Perl SPVM::BlessedObject::String to SPVM String" conversion is contined.
# Converts a Perl scalar to string type SPVM::MyClass->foo("あいう");
Perl can have SPVM string itself as SPVM::BlessedObject::String object. This object is created by such as "new_string", "new_string_from_bin", or got as a return value of SPVM method.
If the value is Perl undef, it is converted to SPVM undef
# Converts a Perl scalar to string type my $string = $api->new_string("あいう"); SPVM::MyClass->foo($string);
No conversion occurs.
Perl can have SPVM class object itself as a object which inherits SPVM::BlessedObject::Class. This object is created by a contructor such as SPVM::Int->new, SPVM::MyClassClass->new.
If the value is Perl undef, it is converted to SPVM undef.
If class name is different, an exception will occur.
# Converts a Perl scalar to class type my $value = SPVM::Int->new(5); SPVM::MyClass->foo($value);
Perl can have SPVM object itself as a SPVM::BlessedObject object. This object is created by a contructor or functions of exchange API such as SPVM::Int->new, SPVM::MyClassClass->new, $api->new_int_array.
# Converts a Perl scalar to any object type my $value = SPVM::Int->new(5); SPVM::MyClass->foo($value);
If the SPVM argument type is byte[], a Perl value is converted by the following rule.
Perl undef is coverted to SPVM undef.
A Perl array reference is converted to a SPVM::BlessedObject::Array object of the byte[] type.
Each element is converted to a value of the byte type by the conversion of "byte Argument".
# Converts a Perl array reference to byte[] type SPVM::MyClass->foo([1, 2, 3]);
If the SPVM argument type is short[], a Perl value is converted by the following rule.
A Perl array reference is converted to a SPVM::BlessedObject::Array object of the short[] type.
Each element is converted to a value of the short type by the conversion of "short Argument".
# Converts a Perl array reference to short[] type SPVM::MyClass->foo([1, 2, 3]);
If the SPVM argument type is int[], a Perl value is converted by the following rule.
A Perl array reference is converted to a SPVM::BlessedObject::Array object of the int[] type.
Each element is converted to a value of the int type by the conversion of "int Argument". Perl undef is coverted to SPVM undef.
# Converts a Perl array reference to int[] type SPVM::MyClass->foo([1, 2, 3]);
A Perl array reference is converted to a SPVM::BlessedObject::Array object of the long[] type.
Each element is converted to a value of the long type by the conversion of "long Argument". Perl undef is coverted to SPVM undef.
# Converts a Perl array reference to long[] type SPVM::MyClass->foo([1, 2, 3]);
If the SPVM argument type is float[], a Perl value is converted by the following rule.
A Perl array reference is converted to a SPVM::BlessedObject::Array object of the float[] type.
Each element is converted to a value of the float type by the conversion of "float Argument". Perl undef is coverted to SPVM undef.
# Converts a Perl array reference to float[] type SPVM::MyClass->foo([1.2, 2.3, 3.4]);
If the SPVM argument type is double[], a Perl value is converted by the following rule.
A Perl array reference is converted to a SPVM::BlessedObject::Array object of the double[] type.
Each element is converted to a value of the double type by the conversion of "double Argument". Perl undef is coverted to SPVM undef.
# Converts a Perl array reference to double[] type SPVM::MyClass->foo([1.2, 2.3, 3.4]);
If the SPVM argument type is string[], a Perl value is converted by the following rule.
string[]
A Perl array reference is converted to a SPVM::BlessedObject::Array object of the string[] type.
Each element is converted to string value by the conversion of "string Argument". Perl undef is coverted to SPVM undef.
# Converts a Perl array reference to string[] type SPVM::MyClass->foo(["あい", "うえ", "お"]);
If the SPVM argument type is a multi-numeric Array, a Perl value is converted by the following rule.
A Perl array reference is converted to a SPVM::BlessedObject::Array object of of a multi-numeric type.
Each element which is a hash reference is converted to multi-numeric type by the conversion of "Multi-Numeric Argument". Perl undef is coverted to SPVM undef.
# Converts a Perl array reference of a hash reference to Complex_2d[] type SPVM::MyClass->foo([{re => 1.2, im => 2.3}, {re => 3.4, im => 4.5}]);
If the SPVM argument type is a other array type of the above, a Perl value is converted by the following rule.
A Perl array reference is converted to a SPVM::BlessedObject::Array of the corresponding array type.
If the SPVM argument type is a multi-numeric type, a Perl value is converted by the following rule.
If the argument type is a multi-numeric byte type, the argument is hash reference is converted to a value of SPVM multi-numeric byte type. If the argument is different from a hash reference, an exception will occur. Each field is converted to a value of the byte type by the conversion of "byte Argument".
If a field is not specified, an exception will occur.
# Converts a Perl hash reference to MyClassPoint_2b type SPVM::MyClass->foo({x => 1, y => 2});
If the argument type is a multi-numeric short type, the argument is hash reference is converted to a value of SPVM multi-numeric short type. If the argument is different from a hash reference, an exception will occur. Each field is converted to a value of the short type by the conversion of "short Argument".
# Converts a Perl hash reference to MyClassPoint_2s type SPVM::MyClass->foo({x => 1, y => 2});
If the argument type is a multi-numeric int type, the argument is hash reference is converted to a value of SPVM multi-numeric int type. If the argument is different from a hash reference, an exception will occur. Each field is converted to a value of the int type by the conversion of "int Argument".
# Converts a Perl hash reference to MyClassPoint_2i type SPVM::MyClass->foo({x => 1, y => 2});
If the argument type is a multi-numeric long type, the argument is hash reference is converted to a value of SPVM multi-numeric long type. If the argument is different from a hash reference, an exception will occur. Each field is converted to a value of the long type by the conversion of "long Argument".
# Converts a Perl hash reference to MyClassPoint_2l type SPVM::MyClass->foo({x => 1, y => 2});
If the argument type is a multi-numeric float type, the argument is hash reference is converted to a value of SPVM multi-numeric float type. If the argument is different from a hash reference, an exception will occur. Each field is converted to a value of the float type by the conversion of "float Argument".
# Converts a Perl hash reference to MyClassPoint_2f type SPVM::MyClass->foo({x => 1.2, y => 2.3});
If the argument type is a multi-numeric double type, the argument is hash reference is converted to a value of SPVM multi-numeric double type. If the argument is different from a hash reference, an exception will occur. Each field is converted to a value of the double type by the conversion of "double Argument".
# Converts a Perl hash reference to MyClassPoint_2d type SPVM::MyClass->foo({x => 1.2, y => 2.3});
If the SPVM argument type is the byte reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM value of the byte reference type.
The value must be a scalar reference of a non-reference scalar. Otherwise an exception will occur.
The value is converted to a SPVM value of the byte type by the conversion of "byte Argument".
The value set by SPVM is converted to a Perl scalar by the conversion of "byte Return Value"
# Converts a Perl scalar reference to byte* type my $value = 23; SPVM::MyClass->foo(\$value);
If the SPVM argument type is the short reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM value of the short reference type.
The value is converted to a SPVM value of the short type by the conversion of "short Argument".
The value set by SPVM is converted to a Perl scalar by the conversion of "short Return Value"
# Converts a Perl scalar reference to short* type my $value = 23; SPVM::MyClass->foo(\$value);
If the SPVM argument type is the int reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM value of the int reference type.
The value is converted to a SPVM value of the int type by the conversion of "int Argument".
The value set by SPVM is converted to a Perl scalar by the conversion of "int Return Value"
# Converts a Perl scalar reference to int* type my $value = 23; SPVM::MyClass->foo(\$value);
If the SPVM argument type is the long reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM value of the long reference type.
The value is converted to a SPVM value of the long type by the conversion of "long Argument".
The value set by SPVM is converted to a Perl scalar by the conversion of "long Return Value"
# Converts a Perl scalar reference to long* type my $value = 23; SPVM::MyClass->foo(\$value);
If the SPVM argument type is the float reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM value of the float reference type.
The value is converted to a SPVM value of the float type by the conversion of "float Argument".
The value set by SPVM is converted to a Perl scalar by the conversion of "float Return Value"
# Converts a Perl scalar reference to float* type my $value = 23.5; SPVM::MyClass->foo(\$value);
If the SPVM argument type is the double reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM value of the double reference type.
The value is converted to a SPVM value of the double type by the conversion of "double Argument".
The value set by SPVM is converted to a Perl scalar by the conversion of "double Return Value"
# Converts a Perl scalar reference to double* type my $value = 23.5; SPVM::MyClass->foo(\$value);
If the SPVM argument type is multi-numeric byte reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM multi-numeric byte reference type.
The reference must be a scalar reference of a hash reference. Otherwise an exception will occur.
Each value of the hash is converted to a value of the byte type by the conversion of "byte Argument".
Each hash value set by SPVM is converted to a Perl number by the conversion of "byte Return Value".
# Converts a Perl scalar reference of a hash reference to MyClassPoint_2b* type my $value = {x => 1, y => 2}; SPVM::MyClass->foo(\$value);
If the SPVM argument type is multi-numeric short reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM multi-numeric short reference type.
Each value of the hash is converted to a value of the short type by the conversion of "short Argument".
Each hash value set by SPVM is converted to a Perl number by the conversion of "short Return Value".
# Converts a Perl scalar reference of a hash reference to MyClassPoint_2s* type my $value = {x => 1, y => 2}; SPVM::MyClass->foo(\$value);
If the SPVM argument type is multi-numeric int reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM multi-numeric int reference type.
Each value of the hash is converted to a value of the int type by the conversion of "int Argument".
Each hash value set by SPVM is converted to a Perl number by the conversion of "int Return Value".
# Converts a Perl scalar reference of a hash reference to SPVM MyClassPoint_2i* type my $value = {x => 1, y => 2}; SPVM::MyClass->foo(\$value);
If the SPVM argument type is multi-numeric long reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM multi-numeric long reference type.
Each value of the hash is converted to a value of the long type by the conversion of "long Argument".
Each hash value set by SPVM is converted to a Perl number by the conversion of "long Return Value".
# Converts a Perl scalar reference of a hash reference to SPVM MyClassPoint_2l* type my $value = {x => 1, y => 2}; SPVM::MyClass->foo(\$value);
If the SPVM argument type is multi-numeric float reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM multi-numeric float reference type.
Each value of the hash is converted to a value of the float type by the conversion of "float Argument".
Each hash value set by SPVM is converted to a Perl number by the conversion of "float Return Value".
# Converts a Perl scalar reference of a hash reference to SPVM MyClassPoint_2f* type my $value = {x => 1,2, y => 2.3}; SPVM::MyClass->foo(\$value);
If the SPVM argument type is multi-numeric double reference type, a Perl value is converted by the following rule.
A Perl reference is converted to a SPVM multi-numeric double reference type.
Each value of the hash is converted to a value of the double type by the conversion of "double Argument".
Each hash value set by SPVM is converted to a Perl number by the conversion of "double Return Value".
# Converts a Perl scalar reference of a hash reference to SPVM MyClassPoint_2d* type my $value = {x => 1.2, y => 2.3}; SPVM::MyClass->foo(\$value);
A SPVM return value is converted to a Perl value by the following rules.
If the SPVM return type is the void type, the following conversion is performed.
SPVM void return value is converted to Perl undef.
If the SPVM return type is the long type, the following conversion is performed.
The SPVM byte value is converted to a Perl scalar using the newSViv perlapi.
The SPVM short value is converted to a Perl scalar using the newSViv perlapi.
If the SPVM return type is the int type, the following conversion is performed.
The SPVM float value is converted to a Perl scalar using the newSViv perlapi.
If the SPVM return type is the float type, the following conversion is performed.
The SPVM float value is converted to a Perl scalar using the newSVnv perlapi.
If the SPVM return type is the double type, the following conversion is performed.
The SPVM double value is converted to a Perl scalar using the newSVnv perlapi.
If the SPVM return type is the string type, the following conversion is performed.
If SPVM return value is undef, it is converted to Perl undef.
Otherwise a SPVM string is converted to a Perl SPVM::BlessedObject::String object.
If the SPVM return type is an multi-numeric type, the following conversion is performed.
The SPVM multi-numeric value is converted to Perl hash reference that has the field names of the multi-numeric type as the keys.
Each numeric field is converted by the rules of "byte Return Value", "short Return Value", "int Return Value", "long Return Value", "float Return Value", "double Return Value".
If the SPVM return type is an array type, the following conversion is performed.
Otherwise a SPVM array is converted to a Perl SPVM::BlessedObject::Array object.
If the SPVM return type is a class type, the following conversion is performed.
Otherwise a SPVM object is converted to a Perl SPVM::BlessedObject::Class object.
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.