Get value from Perl package in GoLang

The GetValue method is used to retrieve the result of an operation performed by the Javonet API.

// use Activate only once in your app

// create called runtime context
calledRuntime, _ := Javonet.InMemory().Perl()

// construct an invocation context - this invocationContext in non-materialized
invocationContext := calledRuntime.GetType("CORE").InvokeStaticMethod("length", "sample text")

// execute invocation context - this will materialize the invocationContext
response, err := invocationContext.Execute()
if err != nil {
	fmt.Println("Error: " + err.Error())

// get value from response
result, ok := response.GetValue().(int32)
if !ok {
	fmt.Println("Error: cannot convert response value to int32")

// write result to console

Commands are becoming nested through each invocation of methods on Invocation Context. Each invocation triggers the creation of new Invocation Context instance wrapping the current command with new parent command valid for invoked method.

Developer can decided on any moment of the materialization for the context taking full control of the chunks of the expression being transferred and processed on target runtime.