The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::Unplug - Simulate the non-availability of modules

VERSION

This document describes Devel::Unplug version 0.03

SYNOPSIS

    $ 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.
  

DESCRIPTION

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.

INTERFACE

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.

DIAGNOSTICS

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.

CONFIGURATION AND ENVIRONMENT

Devel::Unplug requires no configuration files or environment variables.

DEPENDENCIES

None.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

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.

AUTHOR

Andy Armstrong <andy@hexten.net>

TRIVIA

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.

LICENCE AND COPYRIGHT

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.