We (David and Ingy) had a productive week bootstrapping the Inline-for-XS-Modules project. Our primary optimization flags are:
-Opublic
-Oagile
-Ocreative
-Ofun
Here are some highlights:
Dist::Zilla
, Module::Build
, etcIt is our hope to finish out most of the work in the next 2 weeks, and then work on bug reports after that. We plan to keep putting out blog posts/reports for at least a couple months after the grant is complete. We believe this work will make Extension Module Authoring a lot more accessible, and we want to keep the energy flowing.
Here's a tiny example of how to make an Inline Extension Module. Take this one-liner:
perl -E 'use Inline C=>"int add(int a, int b){return a+b;}";say add(2,2)'
Turn it into this module:
package Acme::Math::XS;
our $VERSION = '0.0.1';
use Acme::Math::XS::Inline C => "int add(int a, int b) {return a + b;}";
Install Inline::Module:
cpanm Inline::Module
Run this command line:
> perl-inline-module create Acme::Math::XS::Inline
Add this line to your dist.ini
:
[InlineModule]
Ship it:
dzil release
One advantage we've seen so far is that simple developer testing, just works:
prove -l t/
There's no need to run make
to build the C/C++/XS in blib
and then add -b
to the prove
flags, because this is Inline!