Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / Inline-FAQ.pod
CommitLineData
86530b38
AT
1=head1 NAME
2
3Inline-FAQ - The Inline FAQ
4
5=head1 DESCRIPTION
6
7Welcome to the official Inline FAQ. In this case, B<FAQ> means:
8
9 Formerly Answered Questions
10
11This is a collection of old, long-winded emails that myself and others
12have sent to the Inline mailing list. (inline@perl.org) They have been
13reviewed and edited for general Inline edification. Some of them may be
14related to a specific language. They are presented here in a traditional
15FAQ layout.
16
17=head1 General Inline
18
19Since there is only a handful of content so far, all FAQs are currently
20under this heading.
21
22=head2 How disposable is a .Inline or _Inline directory?
23
24I probably need to be more emphatic about the roll of _Inline/ cache
25directories. Since they are created automatically, they are completely
26disposable. I delete them all the time. And it is fine to have a
27different one for each project. In fact as long as you don't have
28~/.Inline/ defined, Inline will create a new ./_Inline directory. You
29can move that to ./.Inline and it will continue to work if you want to
30give it more longevity and hide it from view. There is a long
31complicated list of rules about how [_.]Inline/ directories are
32used/created. But it was designed to give you the most
33flexibility/ease-of-use. Never be afraid to nuke 'em. They'll just pop
34right back next time. :)
35
36=head2 Whatever happened to the SITE_INSTALL option?
37
38SITE_INSTALL is gone. I was going to leave it in and change the
39semantics, but thought it better to remove it, so people wouldn't try to
40use it the old way. There is now _INSTALL_ (but you're not supposed to
41know that :). It works magically through the use of Inline::MakeMaker. I
42explained this earlier but it's worth going through again because it's
43the biggest change for 0.40. Here's how to 'permanently' install an
44Inline extension (Inline based module) with 0.40:
45
46 1) Create a module with Inline.
47 2) Test it using the normal/local _Inline/ cache.
48 3) Create a Makefile.PL (like the one produced by h2xs)
49 4) Change 'use ExtUtils::MakeMaker' to 'use Inline::MakeMaker'
50 5) Change your 'use Inline C => DATA' to 'use Inline C => DATA => NAME
51 => Foo => VERSION => 1.23'
52 6) Make sure NAME matches your package name ('Foo'), or begins with
53 'Foo::'.
54 7) Make sure VERSION matches $Foo::VERSION. This must be a string (not a
55 number) matching /^\d\.\d\d$/
56 8) Do the perl/make/test/install dance (thanks binkley :)
57
58With Inline 0.41 (or thereabouts) you can skip steps 3 & 4, and just
59say 'perl -MInline=INSTALL ./Foo.pm'. This will work for non-Inline
60modules too. It will become the defacto standard (since there is no easy
61standard) way of installing a Perl module. It will allow Makefile.PL
62parameters 'perl -MInline=INSTALL ./Foo.pm - PREFIX=/home/ingy/perl' and
63things like that. It will also make use of a MANIFEST if you provide
64one.
65
66=head2 How do I create a binary distribution using Inline?
67
68I've figured out how to create and install a PPM binary distribution;
69with or without distributing the C code! And I've decided to share it
70with all of you :)
71
72NOTE: Future versions of Inline will make this process a one line
73command. But for now just use this simple recipe.
74
75---
76
77The Inline 0.40 distribution comes with a sample extension module called
78Math::Simple. Theoretically you could distribute this module on CPAN. It
79has all the necessary support for installation. You can find it in
80Inline-0.40/modules/Math/Simple/. Here are the steps for converting this
81into a binary distribution *without* C source code.
82
83NOTE: The recipient of this binary distribution will need to have the
84PPM.pm module installed. This module requires a lot of other CPAN
85modules. ActivePerl (available for Win32, Linux, and Solaris) has all of
86these bundled. While ActivePerl isn't required, it makes things (a
87lot) easier.
88
891) cd Inline-0.40/Math/Simple/
90
912) Divide Simple.pm into two files:
92
93 ---8<--- (Simple.pm)
94 package Math::Simple;
95 use strict;
96 require Exporter;
97 @Math::Simple::ISA = qw(Exporter);
98 @Math::Simple::EXPORT = qw(add subtract);
99 $Math::Simple::VERSION = '1.23';
100
101 use Inline (C => 'src/Simple.c' =>
102 NAME => 'Math::Simple',
103 VERSION => '1.23',
104 );
105 1;
106 ---8<---
107 ---8<--- (src/Simple.c)
108 int add (int x, int y) {
109 return x + y;
110 }
111
112 int subtract (int x, int y) {
113 return x - y;
114 }
115 ---8<---
116
117So now you have the Perl in one file and the C in the other. The C code
118must be in a subdirectory.
119
1203)
121Note that I also changed the term 'DATA' to the name of the C file. This
122will work just as if the C were still inline.
123
1244) Run 'perl Makefile.PL'
125
1265) Run 'make test'
127
1286) Get the MD5 key from 'blib/arch/auto/Math/Simple/Simple.inl'
129
1307)
131Edit 'blib/lib/Math/Simple.pm'. Change 'src/Simple.c' to
132'02c61710cab5b659efc343a9a830aa73' (the MD5 key)
133
1348) Run 'make ppd'
135
1369)
137Edit 'Math-Simple.ppd'. Fill in AUTHOR and ABSTRACT if you wish. Then
138change:
139
140 <CODEBASE HREF="" />
141
142to
143
144 <CODEBASE HREF="Math-Simple.tar.gz" />
145
14610) Run:
147
148 tar cvf Math-Simple.tar blib
149 gzip --best Math-Simple.tar
150
15111)
152Run:
153
154 tar cvf Math-Simple-1.23.tar Math-Simple.ppd Math-Simple.tar.gz
155 gzip --best Math-Simple-1.23.tar
156
15712) Distribute Math-Simple-1.23.tar.gz with the following instructions:
158
159A) Run:
160
161 gzip -d Math-Simple-1.23.tar.gz
162 tar xvzf Math-Simple-1.23.tar
163
164B) Run 'ppm install Math-Simple.ppd'
165
166C) Delete Math-Simple.tar and Math-Simple.ppd.
167
168D) Test with:
169
170 perl -MMath::Simple -le 'print add(37, 42)'
171
172---
173
174That's it. The process should also work with zip instead of tar, but I
175haven't tried it.
176
177The recipient of the binary must have Perl built with a matching
178architecture. Luckily, ppm will catch this.
179
180For a binary dist *with* C source code, simply omit steps 2, 3, 6, and
1817.
182
183If this seems too hard, then in a future version you should be able to
184just type:
185
186 make ppm
187
188=cut