Help language development. Donate to The Perl Foundation

Inline::Go cpan:AZAWAWI last updated on 2017-12-02



Build Status Build status

Use inline Go code within your Perl 6 source code. The project has the following ambitious goals to achieve:

Note: This currently a totally experimental module. Please do not use on a production system.

The module is currently using simple regular expression to find exported go functions signatures with a simple Go-to-Perl-6 type mapping. The Perl 6 NativeCall Go function wrapper is added via an evil EVAL into the current object via a role (to support multiple objects).


use v6.c;

my $code = '
package main

import ("C"; "fmt")

//export Add_Int32
func Add_Int32(a int, b int) int { return a + b }

//export Hello
func Hello() { fmt.Println("Hello from Go!") }

func main() { }

my $go = :code( $code ) );
say $go.Add_Int32(1, 2);

For more examples, please see the examples folder.


$ zef install Inline::Go


$ prove -ve "perl6 -Ilib"
$ zef install Test::META
$ AUTHOR_TESTING=1 prove -e "perl6 -Ilib"

See Also


Ahmad M. Zawawi, azawawi on #perl6


MIT License