=head1 NAME HACKERS - Devel::PPPort internals for hackers =head1 SYNOPSIS So you probably want to hack C? Well, here's some information to get you started with what's lying around in this distribution. =head1 DESCRIPTION =head2 How to build 98 versions of Perl C supports Perl versions between 5.003 and bleadperl. To guarantee this support, I need some of these versions on my machine. I currently have 98 different Perl version/configuration combinations installed on my laptop. As many of the old Perl distributions need patching to compile cleanly on newer systems (and because building 98 Perls by hand just isn't fun), I wrote a tool to build all the different versions and configurations. You can find it in F. It can currently build the following Perl releases: 5.003 5.004 - 5.004_05 5.005 - 5.005_04 5.6.x 5.7.x 5.8.x 5.9.x =head2 Fully automatic API checks Knowing which parts of the API are not backwards compatible and probably need C support is another problem that's not easy to deal with manually. If you run perl Makefile.PL --with-apicheck a C file is generated by F that is compiled and linked with C. This C file has the purpose of using each of the public API functions/macros once. The required information is derived from C (just a copy of bleadperl's C) and C (which is generated by F and simply collects the rest of the apidoc entries spread over the Perl source code). The generated C file C is currently about 500k in size and takes quite a while to compile. Usually, C won't compile with older perls. And even if it compiles, there's still a good chance of the dynamic linker failing at C time. But that's on purpose! We can use these failures to find changes in the API automatically. The two Perl scripts F and F repeatedly run C with the apicheck code through all different versions of perl. Scanning the output of the compiler and the dynamic linker for errors, the files in F are generated. These files list all parts of the public API that don't work with less than a certain version of Perl. This information is in turn used by F to mask API calls in the generated C file for these versions, so the process can be stopped by the time F compiles cleanly and the dynamic linker is happy. (Actually, this process generates false positives, so each API call is checked once more afterwards.) Running C takes a couple of hours. When running C with the C<--base> option, it will generate the I todo files by disabling all functionality provided by C. These are required for implementing the C<--compat-version> option of the C script. The baseline todo files hold the information about which version of Perl lacks a certain part of the API. However, only the documented public API can be checked this way. And since C provides more macros, these would not be affected by C<--compat-version>. It's the job of F to figure out the baseline information for all remaining provided macros by scanning the include files in the F directory of various Perl versions. It's not very often that one has to regenerate the baseline and todo files, and the process hasn't been automated yet, but it's basically only the following steps: =over 4 =item * You need a whole bunch of different Perls. The more, the better. You can use F to build them. I keep my perls in F, so most of the tools take this as a default. =item * Remove all existing todo files in the F and F directories. =item * Update the API information. Copy the latest F file from bleadperl to the F directory and run F to collect the remaining information in F. =item * Build the new baseline by running perl devel/mktodo --base in the root directory of the distribution. When it's finished, move all files from the F directory to F. =item * Build the new todo files by running perl devel/mktodo in the root directory of the distribution. =item * Finally, add the remaining baseline information by running perl Makefile.PL && make perl devel/scanprov write =back =head2 Implementation Residing in F is the "heart" of C. Each of the files implements a part of the supported API, along with hints, dependency information, XS code and tests. The files are in a POD-like format that is parsed using the functions in F. The scripts F, F and F all use the information in F to generate the main module F, the XS code in F and various test files in F. All of these files could be generated on the fly while building C, but not having the tests in C and not having F will confuse Configure and TEST/harness in the core. Not having F will be bad for viewing the docs on C. So unfortunately, it's unavoidable to put some redundancy into the package. =head2 Adding stuff to Devel::PPPort First, check if the code you plan to add fits into one of the existing files in F. If not, just start a new one and remember to include it from within F. Each file holds all relevant data for implementing a certain part of the API: =over 2 =item * A list of the provided API in the C<=provides> section. =item * The implementation to add to F in the C<=implementation> section. =item * The code required to add to PPPort.xs for testing the implementation. This code goes into the C<=xshead>, C<=xsinit>, C<=xsmisc>, C<=xsboot> and C<=xsubs> section. Have a look at the template in F to see where the code ends up. =item * The tests in the C<=tests> section. Remember not to use any fancy modules or syntax elements, as the test code should be able to run with Perl 5.003, which, for example, doesn't support C in C-loops: for my $x (1, 2, 3) { } # won't work You can use C to report success or failure. =back It's usually the best approach to just copy an existing file and use it as a template. =head2 Testing To automatically test C with lots of different Perl versions, you can use the F script. Just pass it a list of all Perl binaries you want to test. =head2 Special Makefile targets You can use make regen to regenerate all of the autogenerated files. To get rid of all generated files (except for F and F), use make purge_all That's it. =head1 COPYRIGHT Version 3.x, Copyright (C) 2004-2005, Marcus Holland-Moritz. Version 2.x, Copyright (C) 2001, Paul Marquess. Version 1.x, Copyright (C) 1999, Kenneth Albanowski. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO See L. =cut