=head1 DESCRIPTION
-This modules contains a single function, called C<WriteFile>. It is
-used to write a 'C' header file that is used when writing XS modules. The
-file contains a series of macros that allow XS modules to be built using
-older versions of Perl.
-
-This module is primarily used by h2xs to write the file F<ppport.h>.
+Perl has changed over time, gaining new features, new functions,
+increasing its flexibility, and reducing the impact on the C namespace
+environment (reduced pollution). The header file, typicaly C<ppport.h>,
+written by this module attempts to bring some of the newer Perl
+features to older versions of Perl, so that you can worry less about
+keeping track of old releases, but users can still reap the benefit.
+
+Why you should use C<ppport.h> in modern code: so that your code will work
+with the widest range of Perl interpreters possible, without significant
+additional work.
+
+Why you should attempt older code to fully use C<ppport.h>: because
+the reduced pollution of newer Perl versions is an important thing, so
+important that the old polluting ways of original Perl modules will not be
+supported very far into the future, and your module will almost certainly
+break! By adapting to it now, you'll gained compatibility and a sense of
+having done the electronic ecology some good.
+
+How to use ppport.h: Don't direct the user to download C<Devel::PPPort>,
+and don't make C<ppport.h> optional. Rather, just take the most recent
+copy of C<ppport.h> that you can find (probably in C<Devel::PPPort>
+on CPAN), copy it into your project, adjust your project to use it,
+and distribute the header along with your module.
+
+C<Devel::PPPort> contains a single function, called C<WriteFile>. It's
+purpose is to write a 'C' header file that is used when writing XS
+modules. The file contains a series of macros that allow XS modules to
+be built using older versions of Perl.
+
+This module is used by h2xs to write the file F<ppport.h>.
=head2 WriteFile
The function returns TRUE if the file was written successfully. Otherwise
it returns FALSE.
+=head1 ppport.h
+
+The file written by this module, typically C<ppport.h>, provides access
+to the following Perl API if not already available:
+
+ DEFSV
+ ERRSV
+ INT2PTR(any,d)
+ MY_CXT
+ MY_CXT_INIT
+ NOOP
+ PERL_REVISION
+ PERL_SUBVERSION
+ PERL_UNUSED_DECL
+ PERL_VERSION
+ PL_Sv
+ PL_compiling
+ PL_copline
+ PL_curcop
+ PL_curstash
+ PL_defgv
+ PL_dirty
+ PL_hints
+ PL_na
+ PL_perldb
+ PL_rsfp_filters
+ PL_rsfpv
+ PL_stdingv
+ PL_sv_no
+ PL_sv_undef
+ PL_sv_yes
+ PTR2IV(d)
+ SAVE_DEFSV
+ START_MY_CXT
+ _aMY_CXT
+ _pMY_CXT
+ aMY_CXT
+ aMY_CXT_
+ aTHX
+ aTHX_
+ boolSV(b)
+ dMY_CXT
+ dMY_CXT_SV
+ dNOOP
+ dTHR
+ gv_stashpvn(str,len,flags)
+ newCONSTSUB(stash,name,sv)
+ newRV_inc(sv)
+ newRV_noinc(sv)
+ newSVpvn(data,len)
+ pMY_CXT
+ pMY_CXT_
+ pTHX
+ pTHX_
+
=head1 AUTHOR
Version 1.x of Devel::PPPort was written by Kenneth Albanowski.
=cut
+
+package Devel::PPPort;
+
+require Exporter;
+require DynaLoader;
#use warnings;
use strict;
-use vars qw( $VERSION $data );
+use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK $data );
+
+$VERSION = "2.0002";
+
+@ISA = qw(Exporter DynaLoader);
+@EXPORT = qw();
+# Other items we are prepared to export if requested
+@EXPORT_OK = qw( );
-$VERSION = "2.0001";
+bootstrap Devel::PPPort;
+
+package Devel::PPPort;
{
local $/ = undef;
1;
__DATA__;
-/* Perl/Pollution/Portability Version __VERSION__ */
-
-/* Automatically Created by __PKG__ on __DATE__ */
-
-/* Do NOT edit this file directly! -- edit PPPort.pm instead. */
-
-
-#ifndef _P_P_PORTABILITY_H_
-#define _P_P_PORTABILITY_H_
-
-/* Copyright (C) 1999, Kenneth Albanowski. This code may be used and
- distributed under the same license as any version of Perl. */
-
-/* For the latest version of this code, please retreive the Devel::PPPort
- module from CPAN, contact the author at <kjahds@kjahds.com>, or check
- with the Perl maintainers. */
-
-/* If you needed to customize this file for your project, please mention
- your changes, and visible alter the version number. */
+/* ppport.h -- Perl/Pollution/Portability Version __VERSION__
+ *
+ * Automatically Created by __PKG__ on __DATE__
+ *
+ * Do NOT edit this file directly! -- Edit PPPort.pm instead.
+ *
+ * Version 2.x, Copyright (C) 2001, Paul Marquess.
+ * Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
+ * This code may be used and distributed under the same license as any
+ * version of Perl.
+ *
+ * This version of ppport.h is designed to support operation with Perl
+ * installations back to 5.004, and has been tested up to 5.8.0.
+ *
+ * If this version of ppport.h is failing during the compilation of this
+ * module, please check if a newer version of Devel::PPPort is available
+ * on CPAN before sending a bug report.
+ *
+ * If you are using the latest version of Devel::PPPort and it is failing
+ * during compilation of this module, please send a report to perlbug@perl.com
+ *
+ * Include all following information:
+ *
+ * 1. The complete output from running "perl -V"
+ *
+ * 2. This file.
+ *
+ * 3. The name & version of the module you were trying to build.
+ *
+ * 4. A full log of the build that failed.
+ *
+ * 5. Any other information that you think could be relevant.
+ *
+ *
+ * For the latest version of this code, please retreive the Devel::PPPort
+ * module from CPAN.
+ *
+ */
/*
- In order for a Perl extension module to be as portable as possible
- across differing versions of Perl itself, certain steps need to be taken.
- Including this header is the first major one, then using dTHR is all the
- appropriate places and using a PL_ prefix to refer to global Perl
- variables is the second.
-*/
+ * In order for a Perl extension module to be as portable as possible
+ * across differing versions of Perl itself, certain steps need to be taken.
+ * Including this header is the first major one, then using dTHR is all the
+ * appropriate places and using a PL_ prefix to refer to global Perl
+ * variables is the second.
+ *
+ */
/* If you use one of a few functions that were not present in earlier
- versions of Perl, please add a define before the inclusion of ppport.h
- for a static include, or use the GLOBAL request in a single module to
- produce a global definition that can be referenced from the other
- modules.
-
- Function: Static define: Extern define:
- newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
-
-*/
+ * versions of Perl, please add a define before the inclusion of ppport.h
+ * for a static include, or use the GLOBAL request in a single module to
+ * produce a global definition that can be referenced from the other
+ * modules.
+ *
+ * Function: Static define: Extern define:
+ * newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
+ *
+ */
/* To verify whether ppport.h is needed for your module, and whether any
- special defines should be used, ppport.h can be run through Perl to check
- your source code. Simply say:
-
- perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
-
- The result will be a list of patches suggesting changes that should at
- least be acceptable, if not necessarily the most efficient solution, or a
- fix for all possible problems. It won't catch where dTHR is needed, and
- doesn't attempt to account for global macro or function definitions,
- nested includes, typemaps, etc.
-
- In order to test for the need of dTHR, please try your module under a
- recent version of Perl that has threading compiled-in.
-
-*/
+ * special defines should be used, ppport.h can be run through Perl to check
+ * your source code. Simply say:
+ *
+ * perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
+ *
+ * The result will be a list of patches suggesting changes that should at
+ * least be acceptable, if not necessarily the most efficient solution, or a
+ * fix for all possible problems. It won't catch where dTHR is needed, and
+ * doesn't attempt to account for global macro or function definitions,
+ * nested includes, typemaps, etc.
+ *
+ * In order to test for the need of dTHR, please try your module under a
+ * recent version of Perl that has threading compiled-in.
+ *
+ */
/*
__DATA__
*/
+#ifndef _P_P_PORTABILITY_H_
+#define _P_P_PORTABILITY_H_
+
#ifndef PERL_REVISION
# ifndef __PATCHLEVEL_H_INCLUDED__
# include "patchlevel.h"
#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
+/* It is very unlikely that anyone will try to use this with Perl 6
+ (or greater), but who knows.
+ */
+#if PERL_REVISION != 5
+# error ppport.h only works with Perl version 5
+#endif /* PERL_REVISION != 5 */
+
#ifndef ERRSV
# define ERRSV perl_get_sv("@",FALSE)
#endif
#endif /* newCONSTSUB */
+#ifndef NOOP
+# define NOOP (void)0
+#endif
+
+#ifdef HASATTRIBUTE
+# define PERL_UNUSED_DECL __attribute__((unused))
+#else
+# define PERL_UNUSED_DECL
+#endif
+
+#ifndef dNOOP
+# define dNOOP extern int Perl___notused PERL_UNUSED_DECL
+#endif
#ifndef START_MY_CXT
* case below uses it to declare the data as static. */
#define START_MY_CXT
-#if PERL_REVISION == 5 && \
- (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
+#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
/* Fetches the SV that keeps the per-interpreter data. */
#define dMY_CXT_SV \
SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE)
#else /* single interpreter */
-#ifndef NOOP
-# define NOOP (void)0
-#endif
-
-#ifdef HASATTRIBUTE
-# define PERL_UNUSED_DECL __attribute__((unused))
-#else
-# define PERL_UNUSED_DECL
-#endif
-
-#ifndef dNOOP
-# define dNOOP extern int Perl___notused PERL_UNUSED_DECL
-#endif
#define START_MY_CXT static my_cxt_t my_cxt;
#define dMY_CXT_SV dNOOP
#endif /* START_MY_CXT */
-
#endif /* _P_P_PORTABILITY_H_ */
+
+/* End of File ppport.h */