{"id":15557719,"url":"https://github.com/fgasper/p5-wasm-wasm3","last_synced_at":"2026-03-18T16:53:48.389Z","repository":{"id":57663725,"uuid":"478276424","full_name":"FGasper/p5-Wasm-Wasm3","owner":"FGasper","description":"CPAN’s Wasm::Wasm3","archived":false,"fork":false,"pushed_at":"2022-11-22T21:23:04.000Z","size":101,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-03T13:45:13.481Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"XS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FGasper.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-05T19:42:17.000Z","updated_at":"2022-05-19T16:23:11.000Z","dependencies_parsed_at":"2023-01-22T02:02:26.004Z","dependency_job_id":null,"html_url":"https://github.com/FGasper/p5-Wasm-Wasm3","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fp5-Wasm-Wasm3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fp5-Wasm-Wasm3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fp5-Wasm-Wasm3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fp5-Wasm-Wasm3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FGasper","download_url":"https://codeload.github.com/FGasper/p5-Wasm-Wasm3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246135739,"owners_count":20729056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T15:20:28.140Z","updated_at":"2026-01-07T21:32:23.457Z","avatar_url":"https://github.com/FGasper.png","language":"XS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nWasm::Wasm3 - Self-contained [WebAssembly](https://webassembly.org/) via [wasm3](https://github.com/wasm3/wasm3)\n\n# SYNOPSIS\n\nBasic setup:\n\n    my $env = Wasm::Wasm3-\u003enew();\n    my $module = $env-\u003eparse_module($wasm_binary);\n    my $runtime = $env-\u003ecreate_runtime(1024)-\u003eload_module($module);\n\nRun [WASI](https://wasi.dev):\n\n    my $exit_code = $runtime-\u003erun_wasi('arg1', 'arg2');\n\nWebAssembly-exported globals:\n\n    my $global = $module-\u003eget_global('some-value');\n\n    $module-\u003eset_global('some-value', 1234);\n\nWebAssembly-exported memory:\n\n    $runtime-\u003eset_memory( $offset, $bytes );\n\n    my $from_wasm = $runtime-\u003eget_memory( $offset, $length );\n\nCall a WebAssembly-exported function:\n\n    my @out = $runtime-\u003ecall('some-func', @args);\n\nImplement a WebAssembly-imported function in Perl:\n\n    $runtime-\u003elink_function('mod-name', 'func-name', 'v(ii)', $coderef);\n\n(`v(ii)` is the function’s signature; see [Wasm::Wasm3::Runtime](https://metacpan.org/pod/Wasm%3A%3AWasm3%3A%3ARuntime) for\ndetails.)\n\n# DESCRIPTION\n\nWell-known WebAssembly runtimes like [Wasmer](https://wasmer.io),\n[Wasmtime](https://wasmtime.dev), or [WAVM](https://github.com/wavm/wavm)\noften require nonstandard dependencies/toolchains (e.g., LLVM or Rust).\nTheir builds can take a while, especially on slow machines, and only\nthe most popular platforms may enjoy support.\n\n[wasm3](https://github.com/wasm3/wasm3) takes a different tactic from\nthe aforementioned “big dogs”: whereas those are all JIT compilers,\nwasm3 is a WebAssembly _interpreter_. This makes it quite small and\nfast/simple to build, which lets you run WebAssembly in environments\nthat something bigger may not support. Runtime performance lags the\n“big dogs” significantly, but startup latency will likely be lower, and\nmemory usage is **much** lower.\n\nThis distribution includes wasm3, so you don’t need to build it yourself.\n\n# STATUS\n\nThis Perl library is EXPERIMENTAL.\n\nAdditionally, wasm3 is, as of this writing, rather less complete than\nWasmer et al. wasm3 only exports a single WebAssembly memory, for\nexample. It can’t import memories or globals, and it neither imports\n_nor_ exports tables.\n\n# [WASI](https://wasi.dev) SUPPORT\n\nwasm3 implements WASI via either of (as of this writing) two backends:\na wrapper around [uvwasi](https://github.com/nodejs/uvwasi), and a\nless-complete original implementation. The former needs\n[libuv](https://libuv.org), which doesn’t compile on all platforms,\nwhile the latter should compile everywhere this module can run.\n\nThis distribution’s `Makefile.PL` implements logic to determine which\nbackend to use.\n\nYou’re free, of course, to implement your own WASI imports rather than to\nuse wasm3’s. Depending on how much of WASI you actually need that may not\nbe as onerous as it sounds; see the distribution’s `t/wasi_pp.t` for an\nexample.\n\n# MEMORY LEAK DETECTION\n\nTo help you avoid memory leaks, instances of all classes `warn()`\nif their `DESTROY()` method runs at global destruction time.\n\nThis necessitates extra care when linking Perl functions to WASM;\nsee [Wasm::Wasm3::Module](https://metacpan.org/pod/Wasm%3A%3AWasm3%3A%3AModule) for details, and the distribution’s\n`t/wasi_pp.t` for an example.\n\n# DOCUMENTATION\n\nThis module generally documents only those aspects of its usage that\nare germane to this module specifically. For more details, see\nwasm3’s documentation.\n\n# STATIC FUNCTIONS \u0026 CONSTANTS\n\n## ($MAJOR, $MINOR, $REV) = M3\\_VERSION\n\nReturns wasm3’s version as 3 integers.\n\n## $STRING = M3\\_VERSION\\_STRING\n\nReturns wasm3’s version as a string.\n\n## `TYPE_I32`, `TYPE_I64`, `TYPE_F32`, `TYPE_F64`\n\nNumeric constants that indicate the corresponding WebAssembly type.\n\n## $YN = WASI\\_BACKEND\n\nEither `uvwasi` or `simple`. See above about WASI support for\ndetails.\n\n# METHODS\n\n## $OBJ = _CLASS_-\u003enew()\n\nInstantiates _CLASS_.\nCreates a new wasm3 environment and binds it to the returned object.\n\n## $RUNTIME = _OBJ_-\u003ecreate\\_runtime( $STACKSIZE )\n\nCreates a new wasm3 runtime from _OBJ_.\nReturns a [Wasm::Wasm3::Runtime](https://metacpan.org/pod/Wasm%3A%3AWasm3%3A%3ARuntime) instance.\n\n## $MODULE = _OBJ_-\u003eparse\\_module( $WASM\\_BINARY )\n\nLoads a WebAssembly module from _binary_ (`*.wasm`) format.\nReturns a [Wasm::Wasm3::Module](https://metacpan.org/pod/Wasm%3A%3AWasm3%3A%3AModule) instance.\n\nIf your WebAssembly module is in text format rather than binary,\nyou’ll need to convert it first. Try\n[wabt](https://github.com/webassembly/wabt) if you need such a tool.\n\n# LICENSE \u0026 COPYRIGHT\n\nCopyright 2022 Gasper Software Consulting. All rights reserved.\n\nThis library is licensed under the same terms as Perl itself.\nSee [perlartistic](https://metacpan.org/pod/perlartistic).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgasper%2Fp5-wasm-wasm3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgasper%2Fp5-wasm-wasm3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgasper%2Fp5-wasm-wasm3/lists"}