04-visit_one_distro.pl - Use the get_id_dir(), identify_distros_from_derived_list() and visit() methods
get_id_dir()
identify_distros_from_derived_list()
visit()
perl 04-visit_one_distro.pl \ 'A/AD/ADAMK/Params-Util-1.00.tar.gz' \ /path/to/alternate/extutils-parsexs/lib
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.
action
To install CPAN::Mini::Visit::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CPAN::Mini::Visit::Simple
CPAN shell
perl -MCPAN -e shell install CPAN::Mini::Visit::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.