The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

01-distros_with_xs.pl

SYNOPSIS

  perl 01-distros_with_xs.pl       # search all of minicpan

  perl 01-distros_with_xs.pl '/B'  # search only author directory 'authors/id/B/'

DESCRIPTION

This is an example of a program which uses CPAN::Mini::Visit::Simple. It does two things:

  1. It traverses your minicpan repository (location as determined by your .minicpanrc file) and makes a list of the contents. For future reuse, that list is stored in a file, here called authors.txt. You may narrow the search with an optional command-line argument consisting of a string starting with a forward-slash (/) denoting a subdirectory of authors/id/.

  2. It then uses the in-memory version of that list to re-traverse the minicpan and visit each distribution in turn. The action of the visit is to examine the distribution's MANIFEST and determine from that document whether the distribution contains .xs files. If it does, a line is printed to STDOUT in the following format:

      C/CH/CHM/OpenGL-0.62.tar.gz:OpenGL.xs   pgopogl.xs      ...

    ... i.e., the portion of the distribution's path below the authors/id directory, followed by a colon, followed by a tab-delimited list of the .xs files found in the distribution.

    The list of distributions with XS may then be redirected to a file via the command-line.

David Golden recommended the use of quiet => 1 option to visit() to hide warnings from distributions which fail to unpack properly.

On a vintage 2004 iBook G4, this program took 108 minutes to run, which the user considered to be satisfactory.