Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl 6 script compiles to different targets

I have a Go Script which complied to Windows and Linux where i provide it to my customers.

I started exploring Perl6 and want to write the new version with perl 6 , does anyone know if Perl 6 have any option like :

Go build , GOOS AND GOARCH where the user can set the OS and ARCH and create new executable where it will be used by the end user?

like image 492
jsor Avatar asked Oct 07 '18 13:10

jsor


2 Answers

Perl 6 compiles to its own virtual machine, but from the outside it looks like an interpreted language. You don't need to set different compiling options, it will all compile to MoarVM (or Java VM) adapting to the operating system it's in.

like image 67
jjmerelo Avatar answered Nov 06 '22 00:11

jjmerelo


In contrast to Go, which by default compiles to a native executable, the current Perl 6 implementation requires a virtual machine to run. This is similar to other scripting languages like Python or PHP. The virtual machine is itself an executable that is dependent on OS and ARCH.

So Perl 6 currently does not offer an option to build native executable files from scripts.

However there is a tool called Perl 6 WiX Installer Maker that can create Windows MSI installers for Perl 6 scripts. Such installers bundle everything needed to run (virtual machine, compiler and runtime) in addition to the script itself. It's still a young project, so expect some bumps on the road.

like image 2
Patrick Böker Avatar answered Nov 06 '22 00:11

Patrick Böker