Andreas J. König > Perl-Repository-APC-2.002001 > patchaperlup


Annotate this POD


Open  0
View/Report Bugs


patchaperlup - apply a couple of patches in a perl source directory


  patchaperlup --perldir perldir
               --diffdir diffdir
               [ --start patch-number ]
               [ --upto  patch-number ]
               [ --quiet ]
               [ --version ]


This utility runs a batch of jobs that upgrade an arbitrary source snapshot of perl with selected numbered patches to produce another snapshot of perl. It is designed to be called from other utilities (such as apc-buildaperl) that implement a source repository in the broader sense.

How to get at perl patches is described in the perlhack manpage.

When you have unpacked a perl source tarball or otherwise produced a source snapshot, patchaperlup should be run as

  perl patchaperlup --perldir perl5.5.660 --diffdir diffs

patchaperlup checks which highest numbered patch has already been applied to the perl in the perldir. The --upto argument defaults to the highest numbered patch in the directory given by the --diffdir argument. The --start argument defaults to the last patch referenced in the Changes file in the untarred perl sources plus one.

So the above command is equivalent to something like

  perl patchaperlup --perldir perl5.5.660 --diffdir diffs \
       --start 5199 --upto 12345

depending on the contents of your diffdir. (perl5.5.660 had finished with patch 5198.)

The batch job is pretty verbose and explains what it is doing. The reason for the verbosity is that it can take a while until patchaperlup is finishing. Verbosity can be turned off with the --quiet switch and increased with the --verbose switch.

patchaperlup prints a few mail-header-like lines to STDOUT, namely

  Version: version of patchaperlup
  Perldir: perl directory
  Diffdir: directory containing the patches
  Firstpatch: number of the first applied patch
  Lastpatch: number of the last applied patch

everything else is printed to STDERR.

If the --writedotpatch switch is set (a boolean) we write a .patch file which then causes perl to include this number in $Config::Config{version_patchlevel_string}.

The --version switch prints the version and exits.


Patchaperlup skips patching of many files it considers inconvenient. See the source code for a list of these.

Patchaperlup fails miserably on case tolerant filesystems.


The whole suite is only tested on Linux (and, except for the two deprecated scripts, on Mac OS X). It probably doesn't work correctly on non-Unix operating systems. A good part of the scripts and modules does use File::Spec in the relevant places, but it's not sure that this is sufficient to make them portable. Please use with extra caution on other platforms.

The programs zcat (gzcat on Darwin/Mac OS X) and patch must be in your path. Likewise perl and the utility patchls (which can be found in recent perl distributions) must also be available in the path. patchls must not be too old (the one with 5.8.0 is OK). Also, patch must not be too old, I'm using 2.5.9 and I have heard of older versions that are not 8bit clean which fails for the many patches that contain 8bit data.

If you're frequently compiling the resulting perls, the use of ccache ( is highly recommended. It made my average compile time 60 seconds shorter.


Andreas Koenig <>

syntax highlighting: