1Inline::Module(3) User Contributed Perl Documentation Inline::Module(3)
2
3
4
6 Inline::Module - Support for Inline-based CPAN Extension Modules
7
9 This document describes Inline::Module version 0.34. ";
10
12 In your module (say "Acme::Math::XS"):
13
14 use Acme::Math::XS::Inline C =>
15 "long add(long a, long b) { return a + b; }";
16
17 In "Makefile.PL":
18
19 use lib 'inc';
20 use ExtUtils::MakeMaker;
21 use Inline::Module;
22
23 WriteMakefile(
24 NAME => 'Acme::Math::XS',
25 postamble => {
26 inline => {
27 module => 'Acme::Math::XS',
28 stub => 'Acme::Math::XS::Inline',
29 ilsm => 'Inline::C',
30 makestub => 1,
31 },
32 },
33 );
34
36 This module provides support and documentation for creating and
37 maintaining CPAN extension modules. ie Writing XS modules without
38 having to learn XS.
39
40 The Inline::Module::Tutorial explains the simple processes involved.
41
42 When used from a "Makefile.PL", this module provides support for
43 modifying the Makefile generated by ExtUtils::MakeMaker.
44
45 You just need to provide a "postamble" section. See below.
46
47 You also need to make sure that the "inc/" directory is in @INC. This
48 is where the build tools will be when your module is shipped to CPAN.
49
50 postamble Section
51 Arguments are key/value pairs.
52
53 "module"
54 module => 'My::Module',
55
56 Required. This is the module that contains inline "C" or "C++"
57 code. It can be an array ref of multiple modules.
58
59 "stub"
60 stub => 'My::Module::Inline',
61
62 Optional. This is the name of the Inline::Module generated stub
63 module. It's value defaults to the "module" argument with
64 '::Inline' appended. It can be an array ref of multiple modules.
65
66 "ilsm"
67 ilsm => 'Inline::CPP',
68
69 Optional. This is the Inline Language Support Module (ilsm) that
70 you are using. It defaults to Inline::C. It can be an array ref of
71 multiple ilsm-s.
72
73 "makestub"
74 makestub => 1,
75
76 This will cause the stubs to be updated every time the
77 "Makefile.PL" is run.
78
79 "bundle"
80 bundle => 0,
81
82 By default Inline::Module will bundle all the dependencies under
83 your distribution's "inc/" directory. Setting this option to 0 will
84 disable that, but then you are responsible for declaring all the
85 dependencies yourself. Do this with the knowledge that if Inline::*
86 APIs change, your distribution may break.
87
89 During development, Inline::Module needs to generate stub modules. For
90 the case in the synopsis, it would need to generate
91 "Acme::Math::XS::Inline". There a couple ways to do this. The explicit
92 way is:
93
94 perl -MInline::Module=makestub,Acme::Math::XS::Inline
95
96 You can also add "makestub => 1" to your "Makefile.PL" inline section.
97 Every time you run "perl Makefile.PL" as an author, the stubs will be
98 generated under the "lib/" directory.
99
101 When Inline is invoked it will use the ".inline/" directory to do it.
102 This is temporary build cache directory. You may want to add ".inline/"
103 to your ".gitignore" (or similar) file.
104
105 You may also want to add the stub file paths to ".gitignore". You may
106 also want to consider committing them. Even though they are generated
107 code, they are very small and should almost never change. Committing
108 them may be easier for your collaborating developers.
109
111 This module was written as the major portion of the work for a 2014
112 Perl Foundation grant:
113
114 <http://news.perlfoundation.org/2014/09/grant-proposal-inlinecpp-modul.html>
115
117 · Inline::Module::Tutorial
118
119 · Inline
120
121 · Inline::C
122
123 · Inline::CPP
124
125 Also see these modules made with Inline::Module:
126
127 · Alt::Acme::Math::XS::EUMM
128
129 · Acme::Math::XS (Pure XS version)
130
131 · Alt::Acme::Math::XS::CPP
132
133 · Alt::Acme::Math::XS::DistZilla
134
135 · Alt::Acme::Math::XS::ModuleBuild
136
137 · Alt::Acme::Math::XS::ModuleInstall
138
139 · Alt::Acme::Math::XS::ZillaDist
140
141 · Alt::Acme::Math::XS::External
142
143 · Alt::Devel::GlobalDestruction::XS::Inline
144
145 · Alt::Math::Prime::FastSieve::Inline
146
147 And see these plugins for your favorite module framework:
148
149 · DistZilla::Plugin::InlineModule
150
151 · Module::Build::InlineModule
152
153 · Module::Install::InlineModule
154
156 When this module was first created in November 2014, we belatedly
157 realized that there was already an Inline::Module on CPAN, by Ingy. The
158 other one is to "inline" one module inside another. It appears that
159 nobody uses the old one, but if that is not the case, contact INGY and
160 he'll redo that one under another name.
161
163 Ingy döt Net <ingy@cpan.org>
164
166 Copyright 2014-2015. Ingy döt Net.
167
168 This program is free software; you can redistribute it and/or modify it
169 under the same terms as Perl itself.
170
171 See <http://www.perl.com/perl/misc/Artistic.html>
172
173
174
175perl v5.28.0 2015-02-17 Inline::Module(3)