The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

To use this script, create the following directory structure under t/:

      prereq_scenarios/
         old_html_fif/
              HTML/
                  FillInForm.pm

...where FillInForm.pm is version 1.00 of HTML::FillInForm

This script allows you to run the test suite while simulating a different set of installed Perl modules.

For instance, you can simulate a situation where an older version of one module is installed, and where a second module is absent.

This works even if you have the latest version of both modules installed on your system.

You can create multiple test scenarios to simulate different combinations of modules.

For each module scenario you want to simulate, create a directory in your test folder, under prereq_scenarios:

    $ mkdir -p t/prereq_scenarios/html_fif_1.00

Place any modules under this directory.

To simulate the absense of a module, create an empty file. For instance if you wanted to create a scenario called 'skip_tt+ttt' which simulates the absense of Text::Template and Text::TagTemplate, you would do the following:

    $ mkdir t/skip_lib/skip_tt+ttt
    $ mkdir t/skip_lib/skip_tt+ttt/Text
    $ touch t/skip_lib/skip_tt+ttt/Text/Template.pm
    $ touch t/skip_lib/skip_tt+ttt/Text/TagTemplate.pm

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

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

Note that this technique only works when your modules and test scripts play nice.

Instaed of:

    use Petal;
    ok(...some Petal related test...);

you should do:

    SKIP: {
        eval { require Petal };
        if ($@) {
            skip "Petal not installed", 1;
        }
        ok(...some Petal related test...);
    }