Upgrade to Devel::PPPort 3.07
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / parts / inc / ppphdoc
CommitLineData
adfe19db 1################################################################################
2##
0d0f8426 3## $Revision: 25 $
adfe19db 4## $Author: mhx $
0d0f8426 5## $Date: 2006/01/14 18:08:00 +0100 $
adfe19db 6##
7################################################################################
8##
0d0f8426 9## Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
adfe19db 10## Version 2.x, Copyright (C) 2001, Paul Marquess.
11## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
12##
13## This program is free software; you can redistribute it and/or
14## modify it under the same terms as Perl itself.
15##
16################################################################################
17
18=provides
19
20=dontwarn
21
22NEED_function
23NEED_function_GLOBAL
0d0f8426 24NEED_variable
25NEED_variable_GLOBAL
adfe19db 26DPPP_NAMESPACE
27
28=implementation
29
30=pod
31
32=head1 NAME
33
34ppport.h - Perl/Pollution/Portability version __VERSION__
35
36=head1 SYNOPSIS
37
4a582685 38 perl ppport.h [options] [source files]
39
40 Searches current directory for files if no [source files] are given
adfe19db 41
42 --help show short help
43
44 --patch=file write one patch file with changes
45 --copy=suffix write changed copies with suffix
46 --diff=program use diff program and options
47
48 --compat-version=version provide compatibility with Perl version
49 --cplusplus accept C++ comments
50
51 --quiet don't output anything except fatal errors
52 --nodiag don't show diagnostics
53 --nohints don't show hints
54 --nochanges don't suggest changes
4a582685 55 --nofilter don't filter input files
adfe19db 56
0d0f8426 57 --strip strip all script and doc functionality from
58 ppport.h (this, obviously, cannot be undone)
59
adfe19db 60 --list-provided list provided API
61 --list-unsupported list unsupported API
04fc8b94 62 --api-info=name show Perl API portability information
adfe19db 63
64=head1 COMPATIBILITY
65
66This version of F<ppport.h> is designed to support operation with Perl
67installations back to __MIN_PERL__, and has been tested up to __MAX_PERL__.
68
69=head1 OPTIONS
70
71=head2 --help
72
73Display a brief usage summary.
74
75=head2 --patch=I<file>
76
77If this option is given, a single patch file will be created if
78any changes are suggested. This requires a working diff program
79to be installed on your system.
80
81=head2 --copy=I<suffix>
82
83If this option is given, a copy of each file will be saved with
84the given suffix that contains the suggested changes. This does
85not require any external programs.
86
87If neither C<--patch> or C<--copy> are given, the default is to
88simply print the diffs for each file. This requires either
89C<Text::Diff> or a C<diff> program to be installed.
90
91=head2 --diff=I<program>
92
93Manually set the diff program and options to use. The default
94is to use C<Text::Diff>, when installed, and output unified
95context diffs.
96
97=head2 --compat-version=I<version>
98
99Tell F<ppport.h> to check for compatibility with the given
100Perl version. The default is to check for compatibility with Perl
101version __MIN_PERL__. You can use this option to reduce the output
102of F<ppport.h> if you intend to be backward compatible only
0d0f8426 103down to a certain Perl version.
adfe19db 104
105=head2 --cplusplus
106
107Usually, F<ppport.h> will detect C++ style comments and
108replace them with C style comments for portability reasons.
109Using this option instructs F<ppport.h> to leave C++
110comments untouched.
111
112=head2 --quiet
113
114Be quiet. Don't print anything except fatal errors.
115
116=head2 --nodiag
117
118Don't output any diagnostic messages. Only portability
119alerts will be printed.
120
121=head2 --nohints
122
123Don't output any hints. Hints often contain useful portability
124notes.
125
126=head2 --nochanges
127
128Don't suggest any changes. Only give diagnostic output and hints
129unless these are also deactivated.
130
4a582685 131=head2 --nofilter
132
133Don't filter the list of input files. By default, files not looking
134like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
135
0d0f8426 136=head2 --strip
137
138Strip all script and documentation functionality from F<ppport.h>.
139This reduces the size of F<ppport.h> dramatically and may be useful
140if you want to include F<ppport.h> in smaller modules without
141increasing their distribution size too much.
142
adfe19db 143=head2 --list-provided
144
145Lists the API elements for which compatibility is provided by
146F<ppport.h>. Also lists if it must be explicitly requested,
147if it has dependencies, and if there are hints for it.
148
149=head2 --list-unsupported
150
151Lists the API elements that are known not to be supported by
152F<ppport.h> and below which version of Perl they probably
153won't be available or work.
154
04fc8b94 155=head2 --api-info=I<name>
156
157Show portability information for API elements matching I<name>.
9132e1a3 158If I<name> is surrounded by slashes, it is interpreted as a regular
159expression.
04fc8b94 160
adfe19db 161=head1 DESCRIPTION
162
163In order for a Perl extension (XS) module to be as portable as possible
164across differing versions of Perl itself, certain steps need to be taken.
165
166=over 4
167
168=item *
169
170Including this header is the first major one. This alone will give you
171access to a large part of the Perl API that hasn't been available in
172earlier Perl releases. Use
173
174 perl ppport.h --list-provided
175
176to see which API elements are provided by ppport.h.
177
178=item *
179
180You should avoid using deprecated parts of the API. For example, using
181global Perl variables without the C<PL_> prefix is deprecated. Also,
182some API functions used to have a C<perl_> prefix. Using this form is
183also deprecated. You can safely use the supported API, as F<ppport.h>
184will provide wrappers for older Perl versions.
185
186=item *
187
0d0f8426 188If you use one of a few functions or variables that were not present in
189earlier versions of Perl, and that can't be provided using a macro, you
190have to explicitly request support for these functions by adding one or
adfe19db 191more C<#define>s in your source code before the inclusion of F<ppport.h>.
192
0d0f8426 193These functions or variables will be marked C<explicit> in the list shown
194by C<--list-provided>.
adfe19db 195
196Depending on whether you module has a single or multiple files that
0d0f8426 197use such functions or variables, you want either C<static> or global
198variants.
adfe19db 199
0d0f8426 200For a C<static> function or variable (used only in a single source
201file), use:
adfe19db 202
203 #define NEED_function
0d0f8426 204 #define NEED_variable
adfe19db 205
0d0f8426 206For a global function or variable (used in multiple source files),
207use:
adfe19db 208
209 #define NEED_function_GLOBAL
0d0f8426 210 #define NEED_variable_GLOBAL
adfe19db 211
0d0f8426 212Note that you mustn't have more than one global request for the
213same function or variable in your project.
adfe19db 214
215 __EXPLICIT_API__
216
217To avoid namespace conflicts, you can change the namespace of the
0d0f8426 218explicitly exported functions / variables using the C<DPPP_NAMESPACE>
219macro. Just C<#define> the macro before including C<ppport.h>:
adfe19db 220
221 #define DPPP_NAMESPACE MyOwnNamespace_
222 #include "ppport.h"
223
224The default namespace is C<DPPP_>.
225
226=back
227
228The good thing is that most of the above can be checked by running
229F<ppport.h> on your source code. See the next section for
230details.
231
232=head1 EXAMPLES
233
234To verify whether F<ppport.h> is needed for your module, whether you
235should make any changes to your code, and whether any special defines
236should be used, F<ppport.h> can be run as a Perl script to check your
237source code. Simply say:
238
239 perl ppport.h
240
241The result will usually be a list of patches suggesting changes
242that should at least be acceptable, if not necessarily the most
243efficient solution, or a fix for all possible problems.
244
245If you know that your XS module uses features only available in
246newer Perl releases, if you're aware that it uses C++ comments,
247and if you want all suggestions as a single patch file, you could
248use something like this:
249
250 perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
251
252If you only want your code to be scanned without any suggestions
253for changes, use:
254
255 perl ppport.h --nochanges
256
257You can specify a different C<diff> program or options, using
258the C<--diff> option:
259
260 perl ppport.h --diff='diff -C 10'
261
262This would output context diffs with 10 lines of context.
263
9132e1a3 264To display portability information for the C<newSVpvn> function,
265use:
266
267 perl ppport.h --api-info=newSVpvn
268
269Since the argument to C<--api-info> can be a regular expression,
270you can use
271
272 perl ppport.h --api-info=/_nomg$/
273
274to display portability information for all C<_nomg> functions or
275
276 perl ppport.h --api-info=/./
277
278to display information for all known API elements.
279
adfe19db 280=head1 BUGS
281
282If this version of F<ppport.h> is causing failure during
283the compilation of this module, please check if newer versions
284of either this module or C<Devel::PPPort> are available on CPAN
285before sending a bug report.
286
287If F<ppport.h> was generated using the latest version of
288C<Devel::PPPort> and is causing failure of this module, please
289file a bug report using the CPAN Request Tracker at L<http://rt.cpan.org/>.
290
291Please include the following information:
292
293=over 4
294
295=item 1.
296
297The complete output from running "perl -V"
298
299=item 2.
300
301This file.
302
303=item 3.
304
305The name and version of the module you were trying to build.
306
307=item 4.
308
309A full log of the build that failed.
310
311=item 5.
312
313Any other information that you think could be relevant.
314
315=back
316
317For the latest version of this code, please get the C<Devel::PPPort>
318module from CPAN.
319
320=head1 COPYRIGHT
321
0d0f8426 322Version 3.x, Copyright (c) 2004-2006, Marcus Holland-Moritz.
adfe19db 323
324Version 2.x, Copyright (C) 2001, Paul Marquess.
325
326Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
327
328This program is free software; you can redistribute it and/or
329modify it under the same terms as Perl itself.
330
331=head1 SEE ALSO
332
333See L<Devel::PPPort>.
334