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

NAME

04-visit_one_distro.pl - Use the get_id_dir(), identify_distros_from_derived_list() and visit() methods

SYNOPSIS

    perl 04-visit_one_distro.pl \
        'A/AD/ADAMK/Params-Util-1.00.tar.gz' \
        /path/to/alternate/extutils-parsexs/lib

DESCRIPTION

This program illustrates how to use the CPAN::Mini::Visit::Simple get_id_dir(), identify_distros_from_derived_list() and visit() methods.

We want to conduct a visit to Adam Kennedy's Params-Util distribution. The first step is to put that distribution on the list of distributions to be examined. We do that with the identify_distros_from_derived_list() method.

Params-Util contains XS code in the file List.xs. make compiles that code into first a C source code file List.c and then into a C object file. Internally, make calls the Perl 5 core program xsubpp to parse the XS code. xsubpp, in turn, is a wrapper around a call to a subroutine in the Perl 5 core module ExtUtils::ParseXS. The actual use case was to test out different versions of ExtUtils::ParseXS and to see whether they resulted in different C source code files.

As you can see by reading the source code and inline comments, quite a bit of hackery was needed to achieve this objective. However, that hackery was neatly encapsulated in the code reference which was the value for the action element in the hash passed by reference to the visit() method.