The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Wasm::Wasmer::Instance

SYNOPSIS

    my $instance = $module->create_instance(
        {
            env => {
                alert => sub { .. },
            },
        }
    );

    $instance->call( 'dothething', 23, 34 );

DESCRIPTION

This class represents an active instance of a given module.

METHODS

Instances of this class are created via Wasm::Wasmer::Module instances. They expose the following methods:

$obj = OBJ->export( $NAME_TXT )

Returns an instance of a Wasm::Wasmer::Extern subclass that OBJ associates with the given $NAME_TXT (text string).

If OBJ contains no such object then undef is returned.

$names_ar = OBJ->export_names_ar()

Returns a reference to an array of the names (text strings) of all of OBJ’s exports.

@ret = OBJ->call( $FUNCNAME_TXT, @INPUTS )

A convenience around:

    $obj->export($FUNCNAME)->call(@INPUTS);