Wasm::Wasmtime::Trap - Wasmtime trap class
version 0.23
use Wasm::Wasmtime; my $store = Wasm::Wasmtime::Store->new; my $trap = Wasm::Wasmtime::Trap->new( $store, "something went bump in the night\0", );
WARNING: WebAssembly and Wasmtime are a moving target and the interface for these modules is under active development. Use with caution.
This class represents a trap, usually something unexpected that happened in Wasm land. This is usually converted into an exception in Perl land, but you can create your own trap here.
my $trap = Wasm::Wasmtime::Trap->new( $store, # Wasm::Wasmtime::Store $message, # Null terminated string );
Create a trap instance. $message MUST be null terminated.
$message
my $message = $trap->message;
Returns the trap message as a string.
my $status = $trap->exit_status;
If the trap was triggered by an exit call, this will return the exist status code. If it wasn't triggered by an exit call it will return undef.
exit
undef
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.
To install Wasm, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Wasm
CPAN shell
perl -MCPAN -e shell install Wasm
For more information on module installation, please visit the detailed CPAN module installation guide.