Add Perl examples - #103
Open
plicease wants to merge 3 commits into
Open
Conversation
plicease
commented
May 2, 2021
| @@ -0,0 +1,13 @@ | |||
| use strict; | |||
| use warnings; | |||
| use 5.010; | |||
Author
There was a problem hiding this comment.
Most of the examples require Perl 5.10 feature of say which makes the code more like the other languages and easier to read without having to us print and explicitly put an "\n"
plicease
commented
May 2, 2021
| $ffi->find_lib( lib => 'objects' ); | ||
| $ffi->load_custom_type('::PtrObject' => 'ZipCodeDatabase' => 'ZipCodeDatabase' ); | ||
|
|
||
| package ZipCodeDatabase { |
Author
There was a problem hiding this comment.
Examples with a package inside of them use the package block syntax for readability. This requires Perl 5.14, which was first released in 2011. It might make sense for all of the examples to require the same version, but I've only specified versions where I need say and the package block syntax, and just the minimum perl required for each example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should address #55. This adds Perl examples to everything except
vector_returnwhich doesn't appear to have a page yet. It does not yet include the prose section for each example file, but I do plan on writing this as well. I was able to test the examples locally, but when I tried to build the docker image I got a diagnostic that I believe is unrelated to this PR:I think this is probably related the the version of node being specified in the Dockerfile.
The Perl library
FFI::Platypusincludes a language plugin for rust: https://metacpan.org/pod/FFI::Platypus::Lang::Rust which includes documentation for Perl programmers wanting to call Rust from Perl. It might be worth linking to, though I am not sure where is the right place. Perhaps in the integer prose section, since that is the example most people will see first.