NAME

lib::prereqs::only - Only allow modules specified in prereqs in dist.ini to be locateable/loadable

VERSION

This document describes version 0.001 of lib::prereqs::only (from Perl distribution lib-prereqs-only), released on 2016-07-08.

SYNOPSIS

% cd perl-Your-Dist
% PERL5OPT=-Mlib::prereqs::only prove -l

To allow RuntimeRecommends prereqs too:

% PERL5OPT=-Mlib::prereqs::only=RuntimeRecommends,1 prove -l

DESCRIPTION

This pragma reads the prerequisites found in dist.ini, the modules found in lib/, and uses lib::filter to only allow those modules to be locateable/loadable. It is useful while testing Dist::Zilla-based distribution: it tests that the prerequisites you specify in dist.ini is already complete (at least to run the test suite).

Some caveats:

  • This pragma currently only works via PERL5OPT

    Using:

    % prove -Mlib::prereqs::only ...

    currently does not work.

By default, only prereqs specified in RuntimeRequires and TestRequires sections are allowed. But you can include other sections too if you want:

% PERL5OPT=-Mlib::prereqs::only=RuntimeRecommends,1,TestSuggests,1 prove ...

Currently only (Runtime|Test)(Requires|Recommends|Suggests) are recognized.

Other options that can be passed to the pragma:

  • allow_core => bool (default: 1)

    This will be passed to lib::filter. If you specify core modules in your prereqs, perhaps you want to set this to 0 (but currently XS modules won't work with allow_core set to 1.

  • debug => bool (default: 0)

    If set to 1, will print debug messages.

  • allow => str

    Specify an extra set of modules to allow. Value is a semicolon-separated list of module names. Will be passed to lib::filter.

  • disallow => str

    Specify an extra set of modules to disallow. Value is a semicolon-separated list of module names. Will be passed to lib::filter.

  • allow_re => str

    Specify module pattern to allow. Will be passed to lib::filter.

  • disallow_re => str

    Specify module pattern to disallow. Will be passed to lib::filter.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/lib-prereqs-only.

SOURCE

Source repository is at https://github.com/perlancar/perl-lib-prereqs-only.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=lib-prereqs-only

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

lib::filter

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.