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

This script allows you to run the test suite, simulating the absense of a particular set of Perl modules, even if they are installed on your system.

To run the test suite multiple times in a row, each tie multiple times (each with a different selection of absent modules), run:

    $ perl misc/prove_prereqs.pl t/*.t

To add a new set of absent modules, make a subdir under t/prereq_scenarios, and add a dummy perl module for every module you want to skip. This file should be empty. For instance if you wanted to simulate the absense of XML::Complicated and Config::Obscure, you would do the following:

    $ mkdir t/prereq_scenarios/skip_xc+co
    $ mkdir t/prereq_scenarios/skip_xc+co/XML
    $ touch t/prereq_scenarios/skip_xc+co/XML/Complicated.pm
    $ mkdir t/prereq_scenarios/skip_xc+co/Config
    $ touch t/prereq_scenarios/skip_xc+co/Config/Obscure.pm

Finally, add this directory to the @Scenarios array below.

Note that this technique only works because of how CAP::Config::Context and its test suite are written. The Config::Context drivers each provide a method returning the list of modules they depend on. Each test script gets the list of modules and attempts to load them:

    my @required_modules = $driver_module->config_modules;

    foreach (@required_modules) {
        eval "require $_;";
        if ($@) {
            return;
        }
    }
    return 1;

If any of the modules fail to load, then the test script skips the tests associated with that module.