Perl 5 version 8.1 documentation



Devel::PPPort - Perl/Pollution/Portability


  1. Devel::PPPort::WriteFile() ; # defaults to ./ppport.h
  2. 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.

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 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.

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 .

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 (and in some cases [*] even if available, access to a fixed interface):

  1. aMY_CXT
  2. aMY_CXT_
  3. _aMY_CXT
  4. aTHX
  5. aTHX_
  6. AvFILLp
  7. boolSV(b)
  8. call_argv
  9. call_method
  10. call_pv
  11. call_sv
  12. DEFSV
  13. dMY_CXT
  14. dMY_CXT_SV
  15. dNOOP
  16. dTHR
  17. dTHX
  18. dTHXa
  19. dTHXoa
  20. ERRSV
  21. get_av
  22. get_cv
  23. get_hv
  24. get_sv
  25. grok_hex
  26. grok_oct
  27. grok_bin
  28. grok_number
  29. grok_numeric_radix
  30. gv_stashpvn(str,len,flags)
  31. INT2PTR(type,int)
  32. IVdf
  33. MY_CXT
  35. newCONSTSUB(stash,name,sv)
  36. newRV_inc(sv)
  37. newRV_noinc(sv)
  38. newSVpvn(data,len)
  39. NOOP
  40. NV
  41. NVef
  42. NVff
  43. NVgf
  48. PL_compiling
  49. PL_copline
  50. PL_curcop
  51. PL_curstash
  52. PL_defgv
  53. PL_dirty
  54. PL_hints
  55. PL_na
  56. PL_perldb
  57. PL_rsfp_filters
  58. PL_rsfpv
  59. PL_stdingv
  60. PL_Sv
  61. PL_sv_no
  62. PL_sv_undef
  63. PL_sv_yes
  64. pMY_CXT
  65. pMY_CXT_
  66. _pMY_CXT
  67. pTHX
  68. pTHX_
  69. PTR2IV(ptr)
  70. PTR2NV(ptr)
  71. PTR2ul(ptr)
  72. PTR2UV(ptr)
  75. SvPVbyte(sv,lp) [*]
  76. UVof
  77. UVSIZE
  78. UVuf
  79. UVxf
  80. UVXf


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.