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   Whatever happened to the "SITE_INSTALL" option?
38       "SITE_INSTALL" is gone. I was going to leave it in and change the
39       semantics, but thought it better to remove it, so people wouldn't try
40       to use it the old way. There is now "_INSTALL_" (but you're not
41       supposed to know that :). It works magically through the use of
42       Inline::MakeMaker. I explained this earlier but it's worth going
43       through again because it's the biggest change for 0.40.  Here's how to
44       'permanently' install an Inline extension (Inline based module) with
45       0.40:
46
47       1.  Create a module with Inline.
48
49       2.  Test it using the normal / local "_Inline/" cache.
50
51       3.  Create a Makefile.PL (like the one produced by h2xs)
52
53       4.  Change 'use ExtUtils::MakeMaker' to 'use Inline::MakeMaker'
54
55       5.  In the Makefile.PL's WriteMakefile() insert:
56
57               CONFIGURE_REQUIRES  =>  {
58                   'Inline::MakeMaker'     => 0.45,
59                   'ExtUtils::MakeMaker'   => 6.52,
60               },
61
62           (See the "Writing Modules with Inline" section of Inline.pod for an
63           explanation / elaboration.)
64
65       6.  Change your 'use Inline C => DATA' to 'use Inline C => DATA => NAME
66           => Foo
67
68       => VERSION => 1.23' + Make sure NAME matches your package name ('Foo'),
69       or => begins with 'Foo::'. + If you want to quiet a harmless warning
70       that will => appear when the module is loaded via "require", do
71       "Inline->init();". See => "Writing Modules with Inline" in the Inline
72       pod for details. + Make sure => VERSION matches $Foo::VERSION. This
73       must be a string (not a number) => matching "/^\d\.\d\d$/" + Do the
74       perl / make / test / install dance => (thanks binkley :)
75
76       With Inline 0.41 (or thereabouts) you can skip steps 3 & 4, and just
77       say "perl -MInline=INSTALL ./Foo.pm". This will work for non-Inline
78       modules too.  It will become the defacto standard (since there is no
79       easy standard) way of installing a Perl module. It will allow
80       Makefile.PL parameters "perl - MInline=INSTALL ./Foo.pm -
81       PREFIX=/home/ingy/perl" and things like that. It will also make use of
82       a MANIFEST if you provide one.
83
84   How do I create a binary distribution using Inline?
85       I've figured out how to create and install a PPM binary distribution;
86       with or without distributing the C code! And I've decided to share it
87       with all of you :)
88
89       NOTE: Future versions of Inline will make this process a one line
90       command. But
91             for now just use this simple recipe.
92
93       The Inline 0.40 distribution comes with a sample extension module
94       called Math::Simple. Theoretically you could distribute this module on
95       CPAN. It has all the necessary support for installation. You can find
96       it in "Inline- 0.40/modules/Math/Simple/". Here are the steps for
97       converting this into a binary distribution without C source code.
98
99       NOTE: The recipient of this binary distribution will need to have the
100             PPM.pm module installed. This module requires a lot of other CPAN
101             modules. ActivePerl (available for Win32, Linux, and Solaris) has
102       all
103             of these bundled. While ActivePerl isn't required, it makes
104       things (a
105             lot) easier.
106
107       1.  cd "Inline-0.40/Math/Simple/"
108
109       2.  Divide Simple.pm into two files:
110
111               ---8<--- (Simple.pm)
112               package Math::Simple;
113               use strict;
114               require Exporter;
115               @Math::Simple::ISA = qw(Exporter);
116               @Math::Simple::EXPORT = qw(add subtract);
117               $Math::Simple::VERSION = '1.23';
118
119               use Inline (C => 'src/Simple.c' =>
120                           NAME => 'Math::Simple',
121                           VERSION => '1.23',
122                          );
123               1;
124               ---8<---
125               ---8<--- (src/Simple.c)
126               int add (int x, int y) {
127                   return x + y;
128               }
129
130               int subtract (int x, int y) {
131                   return x - y;
132               }
133               ---8<---
134
135       3.  now you have the Perl in one file and the C in the other. The C
136           code must be
137
138       in a subdirectory. + Note that I also changed the term 'DATA' to the
139       name of the C file. This will work just as if the C were still inline.
140       + Run 'perl Makefile.PL' + Run 'make test' + Get the MD5 key from
141       "blib/arch/auto/Math/Simple/Simple.inl" + Edit
142       "blib/lib/Math/Simple.pm".  Change "src/Simple.c" to
143       "02c61710cab5b659efc343a9a830aa73" (the MD5 key)
144
145       1.  Run 'make ppd'
146
147       2.  Edit 'Math-Simple.ppd'. Fill in AUTHOR and ABSTRACT if you wish.
148           Then
149
150       change:
151
152             <CODEBASE HREF="" />
153
154           to
155
156             <CODEBASE HREF="Math-Simple.tar.gz" />
157
158       1.  Run:
159
160               tar cvf Math-Simple.tar blib
161               gzip --best Math-Simple.tar
162
163       2.  Run:
164
165               tar cvf Math-Simple-1.23.tar Math-Simple.ppd Math-Simple.tar.gz
166               gzip --best Math-Simple-1.23.tar
167
168       3.  Distribute Math-Simple-1.23.tar.gz with the following instructions:
169
170           1.  Run:
171
172               gzip -d Math-Simple-1.23.tar.gz tar xvzf Math-Simple-1.23.tar
173
174           2.  Run 'ppm install Math-Simple.ppd'
175
176           3.  Delete Math-Simple.tar and Math-Simple.ppd.
177
178           4.  Test with:
179
180               perl -MMath::Simple -le 'print add(37, 42)'
181
182       That's it. The process should also work with zip instead of tar, but I
183       haven't tried it.
184
185       The recipient of the binary must have Perl built with a matching
186       architecture.  Luckily, ppm will catch this.
187
188       For a binary dist with C source code, simply omit steps 2, 3, 6, and 7.
189
190       If this seems too hard, then in a future version you should be able to
191       just type:
192
193           make ppm
194
195   Why does "C/t/09parser.t" fail on Cygwin ?
196       It doesn't always fail on Cygwin, but if you find that it produces
197       "unable to remap .... to same address as parent" errors during the
198       build phase, then it's time for you to run rebaseall.
199
200       See
201       <http://cygwin.com/faq/faq-nochunks.html#faq.using.fixing-fork-failures>
202       and, if needed, seek further help from the Cygwin mailing list.
203
204
205
206perl v5.28.1                      2019-03-31                    Inline::FAQ(3)
Impressum