SPVM::Document::ExchangeAPI - Exchange API
Exchange API is perl functions to exchange Perl data to SPVM data, and reverse.
use SPVM 'SomeModule'; # Convert Perl array reference to SPVM int array my $spvm_nums = SPVM::new_int_array([1, 2, 3]); # Convert SPVM int array to Perl array reference my $nums = $spvm_nums->to_elements; # Create SPVM object(SomeModule need to define new method) my $spvm_object = SomeModule->new;
my $spvm_array = SPVM::new_byte_array([1, 2, 3]);
Convert Perl array reference to SPVM byte array.
Return value is SPVM::Data::Array object.
my $spvm_array = SPVM::new_short_array([1, 2, 3]);
Convert Perl array reference to SPVM short array.
my $spvm_array = SPVM::new_int_array([1, 2, 3]);
Convert Perl array reference to SPVM int array.
my $spvm_array = SPVM::new_long_array([1, 2, 3]);
Convert Perl array reference to SPVM long array.
my $spvm_array = SPVM::new_float_array([0.5, 0.1, 0.3]);
Convert Perl array reference to SPVM float array.
my $spvm_array = SPVM::new_double_array([0.5, 0.1, 0.3]);
my $array = SPVM::new_object_array("TestCase", [$object1, $object2]);
Convert Perl array reference which contains SPVM object to SPVM object array.
An example:
use SPVM 'Point'; my $spvm_point1 = Point->new(0, 1); my $spvm_point2 = Point->new(3, 4); my $spvm_points = SPVM::new_object_array("Point", [$spvm_point1, $spvm_point2]);
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.