Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fgasper/p5-wasm-wasmer
CPAN’s Wasm::Wasmer
https://github.com/fgasper/p5-wasm-wasmer
Last synced: 18 days ago
JSON representation
CPAN’s Wasm::Wasmer
- Host: GitHub
- URL: https://github.com/fgasper/p5-wasm-wasmer
- Owner: FGasper
- License: other
- Created: 2022-02-16T00:53:26.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T04:08:29.000Z (9 months ago)
- Last Synced: 2024-10-22T07:41:49.709Z (2 months ago)
- Language: Perl
- Size: 256 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
# NAME
Wasm::Wasmer - [WebAssembly](https://webassembly.org) in Perl via
[Wasmer](https://wasmer.io)# SYNOPSIS
use Wasm::Wasmer;
my $wasm = Wasm::Wasmer::wat2wasm( <new($wasm)->create_instance();
# Prints 7:
print $instance->call('sum', 2, 5) . $/;# DESCRIPTION
This distribution provides an XS binding for Wasmer.
This provides a simple, fast way to run WebAssembly (WASM) in Perl.# MODULE RELATIONSHIPS
We mostly follow the relationships from
[Wasmer’s C API](https://docs.rs/wasmer-c-api):- [Wasm::Wasmer::Store](https://metacpan.org/pod/Wasm%3A%3AWasmer%3A%3AStore) manages Wasmer’s state, including
storage of any imports & exports. It contains compiler & engine
configuration as well. This object can be auto-created by default
or manually instantiated.
- [Wasm::Wasmer::Module](https://metacpan.org/pod/Wasm%3A%3AWasmer%3A%3AModule) uses a [Wasm::Wasmer::Store](https://metacpan.org/pod/Wasm%3A%3AWasmer%3A%3AStore) instance
to represent a parsed WASM module. This one you always instantiate
manually.
- [Wasm::Wasmer::Instance](https://metacpan.org/pod/Wasm%3A%3AWasmer%3A%3AInstance) uses a [Wasm::Wasmer::Module](https://metacpan.org/pod/Wasm%3A%3AWasmer%3A%3AModule) instance
to represent an in-progress WASM program. You’ll instantiate these
via methods on the [Wasm::Wasmer::Module](https://metacpan.org/pod/Wasm%3A%3AWasmer%3A%3AModule) object.# CHARACTER ENCODING
Generally speaking, strings that in common usage are human-readable
(e.g., names of imports & exports) are character strings. Ensure
that you’ve properly character-decoded such strings, or any non-ASCII
characters will cause encoding bugs.(TIP: Always incorporate code points 128-255 into your testing.)
Binary payloads (e.g., memory contents) are byte strings.
# PLATFORM SUPPORT
As of this writing, Wasmer’s platform support constrains this module
to supporting Linux and macOS only. (Windows might also work?)# SEE ALSO
[Wasm::Wasm3](https://metacpan.org/pod/Wasm%3A%3AWasm3) is an XS binding to [wasm3](https://github.com/wasm3/wasm3),
a broadly-portable WebAssembly interpreter. Try it if you need to run WASM
and don’t have Wasmer (or Wasmtime).[Wasm::Wasmtime](https://metacpan.org/pod/Wasm%3A%3AWasmtime) is an FFI binding to
[https://wasmtime.dev](https://wasmtime.dev), a similar project to Wasmer.[Wasm](https://metacpan.org/pod/Wasm) provides syntactic sugar around Wasm::Wasmtime.
# FUNCTIONS
This namespace defines the following:
## $bin = wat2wasm( $TEXT )
Converts WASM text format to its binary-format equivalent. $TEXT
should be (character-decoded) text.# LICENSE & COPYRIGHT
Copyright 2022 Gasper Software Consulting. All rights reserved.
This library is licensed under the same terms as Perl itself.
See [perlartistic](https://metacpan.org/pod/perlartistic).This library was originally a research project at
[cPanel, L.L.C.](https://cpanel.net).