Wasm::Wasmtime::Extern - Wasmtime extern class
version 0.23
use Wasm::Wasmtime; my $store = Wasm::Wasmtime::Store->new; my $instance = Wasm::Wasmtime::Instance->new( Wasm::Wasmtime::Module->new($store->engine, wat => q{ (module (func (export "foo") (param i32 i32) (result i32) local.get 0 local.get 1 i32.add) (memory (export "bar") 2 3) ) }), $store, ); my $foo = $instance->exports->foo; print $foo->kind, "\n"; # func my $bar = $instance->exports->bar; print $bar->kind, "\n"; # memory
This class represents an object exported from or imported into a Wasm::Wasmtime::Instance. This class cannot be created independently, but subclasses of this class can be retrieved from the Wasm::Wasmtime::Instance object. This is a base class and cannot be instantiated on its own.
It is a base class.
my $string = $extern->kind;
Returns the extern kind as a string. This will be one of:
func
Wasm::Wasmtime::Funcglobal
Wasm::Wasmtime::Globaltable
Wasm::Wasmtime::Tablememory
Wasm::Wasmtime::Memorymy $bool = $extern->is_func;
Returns true if it is a function.
my $bool = $extern->is_global;
Returns true if it is a global.
my $bool = $extern->is_table;
Returns true if it is a table.
my $bool = $extern->is_memory;
Returns true if it is a memory.
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2020-2022 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.