Wasm::Func - Interface to WebAssembly functions
version 0.23
Call Wasm from Perl:
use Wasm -api => 0, -wat => q{ (module (func (export "add") (param i32 i32) (result i32) local.get 0 local.get 1 i32.add) ) } ; print add(1,2), "\n"; # 3
Call Perl from Wasm:
sub hello { print "hello world!\n"; } use Wasm -api => 0, -wat => q{ (module (func $hello (import "main" "hello")) (func (export "run") (call $hello)) ) } ; run(); # hello world!
WARNING: WebAssembly and Wasmtime are a moving target and the interface for these modules is under active development. Use with caution.
This documents the interface to functions for Wasm. Each function exported from WebAssembly is automatically imported into Perl space as a Perl subroutine. Wasm modules can import Perl subroutines using their standard import process.
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.