NAME

File::Which::Patch::Hide - Hide some programs from File::Which

VERSION

This document describes version 0.003 of File::Which::Patch::Hide (from Perl distribution File-Which-Patch-Hide), released on 2016-07-01.

SYNOPSIS

% PERL5OPT=-MFile::Which::Patch::Hide=-prog,'foo;bar' app.pl

In the above example app.pl will think that foo and bar are not in PATH even though they actually are.

% PERL5OPT=-MFile::Which::Patch::Hide=-prog,'/usr/bin/foo' app.pl

The above example hides just /usr/bin/foo but foo might be available in another directory in PATH.

DESCRIPTION

This module can be used to simulate the absence of certain programs. This module works by patching (wrapping) File::Which's which() routine to remove the result if the programs that want to be hidden are listed in the result. So only programs that use which() will be fooled.

An example of how I use this module: Nodejs::Util has a routine get_nodejs_path() which uses File::Which::which() to check for the existence of node.js binary. The get_nodejs_path() routine is used in some of my test scripts to optionally run tests when node.js is available. So to simulate a condition where node.js is not available:

% PERL5OPT=-MFile::Which::Patch::Hide=-prog,'node;nodejs' prove ...

PATCH CONTENTS

  • wrap which

PATCH CONFIGURATION

  • -prog => str

    A string containing semicolon-separated list of program names to hide.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/File-Which-Patch-Hide.

SOURCE

Source repository is at https://github.com/perlancar/perl-File-Which-Patch-Hide.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=File-Which-Patch-Hide

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

Module::Patch

File::Which

To simulate tha absence of some perl modules, you can try: lib::filter, lib::disallow.

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.