Acme-CPANModules-HidingModules
view release on metacpan or search on metacpan
lib/Acme/CPANModules/HidingModules.pm view on Meta::CPAN
our $text = <<'_';
So you want to convince some Perl code that some modules that are actually
installed, aren't? There are several ways to accomplish this, with different
effects and levels of convincing. This list details them.
**Why?**
First of all, why would you want to do this? Almost always, the answer is: for
testing purposes. For example, you want to make sure that your code can work
without an optional module. Or, alternatively, you want to test how your code
fails under the absence of certain modules.
**Making modules not loadable**
Most of the time, you just want to make certain modules not loadable. That is,
making `require SomeModule` or `use Module` fail. To do this, you usually
install a hook at the first element of `@INC`. The hook would die when it
receives a request to load a module that you want to hide. Some tools that work
this way include:
lib/Acme/CPANModules/HidingModules.pm view on Meta::CPAN
=head1 DESCRIPTION
So you want to convince some Perl code that some modules that are actually
installed, aren't? There are several ways to accomplish this, with different
effects and levels of convincing. This list details them.
B<Why?>
First of all, why would you want to do this? Almost always, the answer is: for
testing purposes. For example, you want to make sure that your code can work
without an optional module. Or, alternatively, you want to test how your code
fails under the absence of certain modules.
B<Making modules not loadable>
Most of the time, you just want to make certain modules not loadable. That is,
making C<require SomeModule> or C<use Module> fail. To do this, you usually
install a hook at the first element of C<@INC>. The hook would die when it
receives a request to load a module that you want to hide. Some tools that work
this way include:
lib/Acme/CPANModules/HidingModules.pm view on Meta::CPAN
perlancar <perlancar@cpan.org>
=head1 CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.
Most of the time, you don't need to build the distribution yourself. You can
simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally on your
system), you can install L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
that are considered a bug and can be reported to me.
lib/Acme/CPANModules/HidingModules.pm view on Meta::CPAN
This software is copyright (c) 2023, 2020, 2019 by perlancar <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.
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Acme-CPANModules-HidingModules>
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.
=cut
( run in 1.781 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )