NAME

Wasm::Wasmtime::Trap - Wasmtime trap class

VERSION

version 0.21

SYNOPSIS

 use Wasm::Wasmtime;
 
 my $store = Wasm::Wasmtime::Store->new;
 my $trap = Wasm::Wasmtime::Trap->new(
   $store,
   "something went bump in the night\0",
 );

DESCRIPTION

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.

CONSTRUCTORS

new

 my $trap = Wasm::Wasmtime::Trap->new(
   $store,    # Wasm::Wasmtime::Store
   $message,  # Null terminated string
 );

Create a trap instance. $message MUST be null terminated.

METHODS

message

 my $message = $trap->message;

Returns the trap message as a string.

exit_status

 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.

SEE ALSO

Wasm
Wasm::Wasmtime

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 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.