Perl/Pollution/Portability
Devel::PPPort::WriteFile() ; # defaults to ./ppport.h Devel::PPPort::WriteFile('someheader.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 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.
ppport.h
Why you should use 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 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 Devel::PPPort, and don't make ppport.h optional. Rather, just take the most recent copy of ppport.h that you can find (probably in Devel::PPPort on CPAN), copy it into your project, adjust your project to use it, and distribute the header along with your module.
Devel::PPPort
Devel::PPPort contains a single function, called 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.
WriteFile
This module is used by h2xs to write the file ppport.h.
WriteFile takes a zero or one parameters. When called with one parameter it expects to be passed a filename. When called with no parameters, it defults to the filename ./pport.h.
./pport.h
The function returns TRUE if the file was written successfully. Otherwise it returns FALSE.
The file written by this module, typically 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_
Version 1.x of Devel::PPPort was written by Kenneth Albanowski.
Version 2.x was ported to the Perl core by Paul Marquess.
See h2xs.
To install if, copy and paste the appropriate command in to your terminal.
cpanm
cpanm if
CPAN shell
perl -MCPAN -e shell install if
For more information on module installation, please visit the detailed CPAN module installation guide.