1Inline::FAQ(3)        User Contributed Perl Documentation       Inline::FAQ(3)
2
3
4

NAME

6       Inline-FAQ - The Inline FAQ
7

DESCRIPTION

9       Welcome to the official Inline FAQ. In this case, FAQ means: Formerly
10       Answered Questions
11
12       This is a collection of old, long-winded emails that myself and others
13       have sent to the Inline mailing list. (inline@perl.org) They have been
14       reviewed and edited for general Inline edification. Some of them may be
15       related to a specific language. They are presented here in a
16       traditional FAQ layout.
17

GENERAL INLINE

19       Since there is only a handful of content so far, all FAQs are currently
20       under this heading.
21
22   How disposable is a ".Inline" or "_Inline" directory?
23       I probably need to be more emphatic about the role of "_Inline/" cache
24       directories. Since they are created automatically, they are completely
25       disposable. I delete them all the time. And it is fine to have a
26       different one for each project. In fact as long as you don't have
27       "~/.Inline/" defined, Inline will create a new "./_Inline" directory
28       (unless, you've done something to override this automatic process -
29       such as using the DIRECTORY config option, or using the
30       "PERL_INLINE_DIRECTORY" environment variable). You can move that to
31       "./.Inline" and it will continue to work if you want togive it more
32       longevity and hide it from view. There is a long complicated list of
33       rules about how "[_.]Inline/" directories are used/created. But it was
34       designed to give you the most flexibility/ease-of-use. Never be afraid
35       to nuke 'em. They'll just pop right back next time they're needed. :)
36
37   What is the best way to package Inline code for CPAN?
38       This distribution includes Inline::MakeMaker, described below, which
39       takes special steps during the installation of your module to make sure
40       the code gets compiled and installed, rather than compiled by users at
41       runtime. But, users of your module need to install Inline and the
42       language support module like Inline::CPP as prerequisites for your
43       module.
44
45       A better way to distribute your module is with Inline::Module, which
46       takes special steps to remove dependencies on Inline::* and convert it
47       to a plain XS module during the construction of your distribution
48       before you upload it to CPAN. It also integrates easily with
49       Dist::Zilla and other modern authoring tools for a more streamlined
50       authoring experience.
51
52   Whatever happened to the "SITE_INSTALL" option?
53       "SITE_INSTALL" is gone. I was going to leave it in and change the
54       semantics, but thought it better to remove it, so people wouldn't try
55       to use it the old way. There is now "_INSTALL_" (but you're not
56       supposed to know that :). It works magically through the use of
57       Inline::MakeMaker. I explained this earlier but it's worth going
58       through again because it's the biggest change for 0.40.  Here's how to
59       'permanently' install an Inline extension (Inline based module) with
60       0.40:
61
62       1.  Create a module with Inline.
63
64       2.  Test it using the normal / local "_Inline/" cache.
65
66       3.  Create a Makefile.PL (like the one produced by h2xs)
67
68       4.  Change 'use ExtUtils::MakeMaker' to 'use Inline::MakeMaker'
69
70       5.  In the Makefile.PL's WriteMakefile() insert:
71
72               CONFIGURE_REQUIRES  =>  {
73                   'Inline::MakeMaker'     => 0.45,
74                   'ExtUtils::MakeMaker'   => 6.52,
75               },
76
77           (See the "Writing Modules with Inline" section of Inline.pod for an
78           explanation / elaboration.)
79
80       6.  Change your 'use Inline C => DATA' to 'use Inline C => DATA => NAME
81           => Foo
82
83       => VERSION => 1.23' + Make sure NAME matches your package name ('Foo'),
84       or => begins with 'Foo::'. + If you want to quiet a harmless warning
85       that will => appear when the module is loaded via "require", do
86       "Inline->init();". See => "Writing Modules with Inline" in the Inline
87       pod for details. + Make sure => VERSION matches $Foo::VERSION. This
88       must be a string (not a number) => matching "/^\d\.\d\d$/" + Do the
89       perl / make / test / install dance => (thanks binkley :)
90
91       With Inline 0.41 (or thereabouts) you can skip steps 3 & 4, and just
92       say "perl -MInline=INSTALL ./Foo.pm". This will work for non-Inline
93       modules too.  It will become the defacto standard (since there is no
94       easy standard) way of installing a Perl module. It will allow
95       Makefile.PL parameters "perl - MInline=INSTALL ./Foo.pm -
96       PREFIX=/home/ingy/perl" and things like that. It will also make use of
97       a MANIFEST if you provide one.
98
99   How do I create a binary distribution using Inline?
100       I've figured out how to create and install a PPM binary distribution;
101       with or without distributing the C code! And I've decided to share it
102       with all of you :)
103
104       NOTE: Future versions of Inline will make this process a one line
105       command. But
106             for now just use this simple recipe.
107
108       The Inline 0.40 distribution comes with a sample extension module
109       called Math::Simple. Theoretically you could distribute this module on
110       CPAN. It has all the necessary support for installation. You can find
111       it in "Inline- 0.40/modules/Math/Simple/". Here are the steps for
112       converting this into a binary distribution without C source code.
113
114       NOTE: The recipient of this binary distribution will need to have the
115             PPM.pm module installed. This module requires a lot of other CPAN
116             modules. ActivePerl (available for Win32, Linux, and Solaris) has
117       all
118             of these bundled. While ActivePerl isn't required, it makes
119       things (a
120             lot) easier.
121
122       1.  cd "Inline-0.40/Math/Simple/"
123
124       2.  Divide Simple.pm into two files:
125
126               ---8<--- (Simple.pm)
127               package Math::Simple;
128               use strict;
129               require Exporter;
130               @Math::Simple::ISA = qw(Exporter);
131               @Math::Simple::EXPORT = qw(add subtract);
132               $Math::Simple::VERSION = '1.23';
133
134               use Inline (C => 'src/Simple.c' =>
135                           NAME => 'Math::Simple',
136                           VERSION => '1.23',
137                          );
138               1;
139               ---8<---
140               ---8<--- (src/Simple.c)
141               int add (int x, int y) {
142                   return x + y;
143               }
144
145               int subtract (int x, int y) {
146                   return x - y;
147               }
148               ---8<---
149
150       3.  now you have the Perl in one file and the C in the other. The C
151           code must be
152
153       in a subdirectory. + Note that I also changed the term 'DATA' to the
154       name of the C file. This will work just as if the C were still inline.
155       + Run 'perl Makefile.PL' + Run 'make test' + Get the MD5 key from
156       "blib/arch/auto/Math/Simple/Simple.inl" + Edit
157       "blib/lib/Math/Simple.pm".  Change "src/Simple.c" to
158       "02c61710cab5b659efc343a9a830aa73" (the MD5 key)
159
160       1.  Run 'make ppd'
161
162       2.  Edit 'Math-Simple.ppd'. Fill in AUTHOR and ABSTRACT if you wish.
163           Then
164
165       change:
166
167             <CODEBASE HREF="" />
168
169           to
170
171             <CODEBASE HREF="Math-Simple.tar.gz" />
172
173       1.  Run:
174
175               tar cvf Math-Simple.tar blib
176               gzip --best Math-Simple.tar
177
178       2.  Run:
179
180               tar cvf Math-Simple-1.23.tar Math-Simple.ppd Math-Simple.tar.gz
181               gzip --best Math-Simple-1.23.tar
182
183       3.  Distribute Math-Simple-1.23.tar.gz with the following instructions:
184
185           1.  Run:
186
187               gzip -d Math-Simple-1.23.tar.gz tar xvzf Math-Simple-1.23.tar
188
189           2.  Run 'ppm install Math-Simple.ppd'
190
191           3.  Delete Math-Simple.tar and Math-Simple.ppd.
192
193           4.  Test with:
194
195               perl -MMath::Simple -le 'print add(37, 42)'
196
197       That's it. The process should also work with zip instead of tar, but I
198       haven't tried it.
199
200       The recipient of the binary must have Perl built with a matching
201       architecture.  Luckily, ppm will catch this.
202
203       For a binary dist with C source code, simply omit steps 2, 3, 6, and 7.
204
205       If this seems too hard, then in a future version you should be able to
206       just type:
207
208           make ppm
209
210   Why does "C/t/09parser.t" fail on Cygwin ?
211       It doesn't always fail on Cygwin, but if you find that it produces
212       "unable to remap .... to same address as parent" errors during the
213       build phase, then it's time for you to run rebaseall.
214
215       See
216       <http://cygwin.com/faq/faq-nochunks.html#faq.using.fixing-fork-failures>
217       and, if needed, seek further help from the Cygwin mailing list.
218
219
220
221perl v5.32.1                      2021-01-27                    Inline::FAQ(3)
Impressum