Devel::Unplug - Simulate the non-availability of modules
This document describes Devel::Unplug version 0.03
$ perl -d:Unplug=Some::Module,Some::Other::Module myprog.pl Can't locate Some/Module.pm in @INC (unplugged by Devel::Unplug) at myprog.pl line 5. BEGIN failed--compilation aborted at myprog.pl line 5.
Sometimes - particularly during testing - it's useful to be able to find out how your code behaves when a module it is expecting is unavailable. This module allows you to simulate the non-availability of a module.
It uses Devel::TraceLoad::Hook to replace require (and hence use) and intercept attempts to load modules.
require
use
None of these functions are exportable. Call them using their fully qualified names.
unplug
Unplug one or more modules.
Devel::Unplug::unplug( 'Some::Module', 'Some::Other::Module' );
Regular expressions may be used:
Devel::Unplug::unplug( qr{^Some:: (?: Other:: )? Module$}x );
insert
Make an unplugged module available again.
Devel::Unplug::insert( 'Some::Module' );
You must call insert for a given module as many times as unplug was called to make it available again.
unplugged
Get the list of unplugged modules. The returned array may potentially contain a mixture of regular expressions and plain strings.
Can't locate %s in @INC (unplugged by Devel::Unplug)
The error message that will be displayed when an attempt is made to load a module that has been unplugged.
Devel::Unplug requires no configuration files or environment variables.
None.
None reported.
No bugs have been reported.
Please report any bugs or feature requests to bug-devel-unplug@rt.cpan.org, or through the web interface at http://rt.cpan.org.
bug-devel-unplug@rt.cpan.org
Andy Armstrong <andy@hexten.net>
<andy@hexten.net>
The 'unplug' name and the choice of unplug and insert as the function names is based on the Acorn RISC OS commands of the same name. I'm sure you were wondering.
Copyright (c) 2007, Andy Armstrong <andy@hexten.net>.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Devel::Unplug, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::Unplug
CPAN shell
perl -MCPAN -e shell install Devel::Unplug
For more information on module installation, please visit the detailed CPAN module installation guide.