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_iarray([1, 2, 3]); # Convert SPVM int array to Perl array reference my $nums = $spvm_nums->to_elems; # Create SPVM object(SomeModule need to define new method) my $spvm_object = SomeModule->new;
my $spvm_array = SPVM::new_barray([1, 2, 3]);
Convert Perl array reference to SPVM byte array.
Return value is SPVM::Data::Array object.
my $spvm_array = SPVM::new_sarray([1, 2, 3]);
Convert Perl array reference to SPVM short array.
my $spvm_array = SPVM::new_iarray([1, 2, 3]);
Convert Perl array reference to SPVM int array.
my $spvm_array = SPVM::new_larray([1, 2, 3]);
Convert Perl array reference to SPVM long array.
my $spvm_array = SPVM::new_farray([0.5, 0.1, 0.3]);
Convert Perl array reference to SPVM float array.
my $spvm_array = SPVM::new_darray([0.5, 0.1, 0.3]);
my $array = SPVM::new_oarray("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_oarray("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.