NAME

Wasm::Global - Interface to Web Assembly Memory

VERSION

version 0.09

SYNOPSIS

use Wasm
  -api => 0,
  -wat => q{
    (module
      (global (export "global") (mut i32) (i32.const 42))
    )
  }
;

print "$global\n";  # 42
$global = 99;
print "$global\n";  # 99

DESCRIPTION

This class represents a global variable exported from a WebAssembly module. Each global variable exported from WebAssembly is automatically imported into Perl space as a tied scalar, which allows you to get and set the variable easily from Perl.

CAVEATS

Note that depending on the storage of the global variable setting might be lossy and round-trip isn't guaranteed. For example for integer types, if you set a string value it will be converted to an integer using the normal Perl string to integer conversion, and when it comes back you will just have the integer value.

SEE ALSO

Wasm

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.