Inline::Module(3)
β¨ NAME β¨
Inline::Module β bestie, this is the support + docs situation for building CPAN extension modules with Inline. That's it, that's the vibe π (it's a perl manual page, specifically Inline::Module(3), if you're keeping track π)
π« VERSION π«
This doc is describing Inline::Module version 0.35. Not 0.36, not 0.34, we're locked in. periodt β¨
πΈ SYNOPSIS πΈ
okay so first things first, inside your actual module (let's say Acme::Math::XS, iconic name):
use Acme::Math::XS::Inline C =>
"long add(long a, long b) { return a + b; }";
and then over in your Makefile.PL:
use lib 'inc';
use ExtUtils::MakeMaker;
use Inline::Module;
WriteMakefile(
NAME => 'Acme::Math::XS',
postamble => {
inline => {
module => 'Acme::Math::XS',
stub => 'Acme::Math::XS::Inline',
ilsm => 'Inline::C',
makestub => 1,
},
},
);
that's the whole setup bestie, you're already slaying π«Ά
π¦ DESCRIPTION π¦
This module hands you the support and the documentation you need to create and maintain CPAN extension modules. Like, writing XS modules but without ever having to actually learn XS?? the way that's a gift ππ
The Inline::Module::Tutorial walks you through the simple processes involved β go read it, it's giving helpful.
When you use this from a Makefile.PL, it gives you support for modifying the Makefile that ExtUtils::MakeMaker generated for you. lowkey magic.
You literally just need to provide a postamble section. Details below π
You also need to make sure the inc/ directory is in @INC β that's where the build tools are gonna be living when your module ships to CPAN. don't forget, fr fr.
π postamble Section π
Arguments are key/value pairs, as one does.
module
module => 'My::Module',
Required. This is the module that contains the inline C or C++ code. Heads up: it can also be an array ref of multiple modules. π
stub
stub => 'My::Module::Inline',
Optional (so chill). This is the name of the Inline::Module generated stub module. Its value defaults to the module argument with '::Inline' appended. It can also be an array ref of multiple modules.
ilsm
ilsm => 'Inline::CPP',
Optional. This is the Inline Language Support Module (ilsm) that you're using. It defaults to Inline::C. And yes, it can be an array ref of multiple ilsm-s. multitasking queen π
makestub
makestub => 1,
This will cause the stubs to be updated every single time the Makefile.PL is run. no skips.
bundle
bundle => 0,
By default Inline::Module will bundle all the dependencies under your distribution's inc/ directory. Setting this option to 0 will disable that β but then you are responsible for declaring all the dependencies yourself. π¬
Do this with the knowledge that if Inline::* APIs change, your distribution may break. so like, proceed with caution bestie, that's the risk you're taking π«
π STUB MODULE GENERATION π
During development, Inline::Module needs to generate stub modules. For the case in the synopsis up top, it would need to generate Acme::Math::XS::Inline. There are a couple ways to do this. The explicit way is:
perl -MInline::Module=makestub,Acme::Math::XS::Inline
You can also add makestub => 1 to your Makefile.PL inline section. Every time you run perl Makefile.PL as an author, the stubs will be generated under the lib/ directory. automatic. obsessed. β¨
π GENERATED FILES π
When Inline is invoked it will use the .inline/ directory to do its thing. That's a temporary build cache directory, so you're probably gonna want to add .inline/ to your .gitignore (or whatever similar file you're running). π
You may also want to add the stub file paths to .gitignore. OR β plot twist β you may also want to consider committing them. Even though they're generated code, they're very small and should almost never change. Committing them may be easier for your collaborating developers. your call, main character πΈ
π TPF GRANT π
This module was written as the major portion of the work for a 2014 Perl Foundation grant. iconic behaviour, honestly:
<http://news.perlfoundation.org/2014/09/grant-proposal-inlinecpp-modul.html>
β SEE ALSO β
Inline::Module::TutorialInlineInline::CInline::CPP
Also see these modules made with Inline::Module:
Alt::Acme::Math::XS::EUMMAcme::Math::XS(Pure XS version)
Alt::Acme::Math::XS::CPPAlt::Acme::Math::XS::DistZillaAlt::Acme::Math::XS::ModuleBuildAlt::Acme::Math::XS::ModuleInstallAlt::Acme::Math::XS::ZillaDistAlt::Acme::Math::XS::ExternalAlt::Devel::GlobalDestruction::XS::InlineAlt::Math::Prime::FastSieve::Inline
And see these plugins for your favorite module framework:
DistZilla::Plugin::InlineModuleModule::Build::InlineModuleModule::Install::InlineModule
π NOTE π
okay so when this module was first created in November 2014, we belatedly realized that there was already an Inline::Module on CPAN, by Ingy. The other one is to "inline" one module inside another. It appears that nobody uses the old one, but if that is not the case, contact INGY and he'll redo that one under another name. name collision jumpscare, truly π
π AUTHOR π
Ingy dΓΆt Net <ingy@cpan.org>
π COPYRIGHT AND LICENSE π
Copyright 2014-2026. Ingy dΓΆt Net.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
and that's a wrap bestie π«Ά this was perl v5.42.1, generated 2026-03-31, for Inline::Module(3) β go build something iconic with it πβ¨
π¦ where this page comes from
- fedora 43: perl-Inline-Module 0.35-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Inline-Module 0.35-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms