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