You can now use the spvmcc command to generate an executable file from the SPVM source code.

You can now use the spvmcc command to generate an executable file from the SPVM source code.

SPVM is a module that can convert Perl-like source code into C language and execute it.

I have succeeded in generating an executable in a very stable way.

SPVM source code

# MyApp.spvm
package MyApp : precompile {
  sub main : int ($args : string[]) {
    my $total = 0;
    for (my $i = 0; $i < 100000; $i++) {
      $total += $i;
    }
    
    print "$total\n";
  }
}


Create Excutable File and execute it

Create Executable File

spvmcc -I . -o myapp MyApp

Execute Executable File

./myapp

Github spvmcc basic example

You can install SPVM from CPAN

cpan SPVM

or

cpanm SPVM


Leave a comment

About Yuki Kimoto

user-pic I'm Perl Programmer. I LOVE Perl. I want to contribute Perl community and Perl users.