Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manchicken/rust-interoperability-in-perl
A prototype repo for testing Rust interoperability in Perl.
https://github.com/manchicken/rust-interoperability-in-perl
Last synced: 18 days ago
JSON representation
A prototype repo for testing Rust interoperability in Perl.
- Host: GitHub
- URL: https://github.com/manchicken/rust-interoperability-in-perl
- Owner: manchicken
- License: mpl-2.0
- Created: 2023-12-25T02:51:30.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-30T05:07:34.000Z (about 1 year ago)
- Last Synced: 2023-12-30T06:20:19.602Z (about 1 year ago)
- Language: Perl
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-interoperability-in-perl
A prototype repo for testing Rust interoperability in Perl.
## What is it?
I'm looking at doing some stuff with interoperability between Perl and Rust. This is my test-bed.
## Prerequisites
These C libraries are needed:
- `libffi` with headers
- `libssl` with headersYou will also need a Rust environment. If you don't know how to set this up yet, consider using [rustup](https://rustup.rs/).
You'll also need to install Carton:
```sh
cpan Carton
```(`cpanm` will work, too, if you have `App::Cpanminus` installed)
## Running
### Short version
1. Build the Rust code with `cargo build` (right now I'm only using the `debug` target)
2. Run the scripts individually### Longer version
```sh
cd rust-part; cargo build; cd -
carton install
perl ./add_two.pl
```## The files
The `cpanfile` and `cpanfile.snapshot` are artifacts for the [Carton dependency manager](https://metacpan.org/pod/Carton).
Carton will install the modules in a directory called `local` in the working directory.The `rust-part` folder contains a normal Rust program, but it's a `cdylib` crate so it'll produce a `.so` file.
The scripts themselves are just in the top-level directory, with a `.pl` extension.
## The tests
- Simple adding of two integers (`add_two.pl`)
- Upper-casing a string (`upper_string.pl`)
- Using an opaque pointer in Perl (`opaque_kvp.pl`)
- Using Tokio async (TBD)
- Invoking a Perl callback (TBD)