Devel-Unplug

 view release on metacpan or  search on metacpan

lib/Devel/Unplug.pm  view on Meta::CPAN

}

BEGIN {
    use Devel::TraceLoad::Hook qw( register_require_hook );
    register_require_hook(
        sub {
            my ( $when, $depth, $arg, $p, $f, $l, $rc, $err ) = @_;

            return unless $when eq 'before';
            my $module = _get_module( $arg );
            return unless _is_unplugged( $module );

            # Ain't gonna let you load it
            die "Can't locate $arg in \@INC (unplugged by " . __PACKAGE__ . ")";
        }
    );
}

=head2 C<< unplugged >>

Get the list of unplugged modules. The returned array may potentially
contain a mixture of regular expressions and plain strings.

=cut

sub unplugged {
    map { $_->[0] } values %unplugged;
}

sub import {
    my $class = shift;
    unplug( @_ );
}

1;
__END__

=head1 DIAGNOSTICS

=over

=item C<< 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.

=back

=head1 CONFIGURATION AND ENVIRONMENT
  
Devel::Unplug requires no configuration files or environment variables.

=head1 DEPENDENCIES

None.

=head1 INCOMPATIBILITIES

None reported.

=head1 BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to
C<bug-devel-unplug@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.

=head1 AUTHOR

Andy Armstrong  C<< <andy@hexten.net> >>

=head1 TRIVIA

The 'unplug' name and the choice of C<unplug> and C<insert> as the
function names is based on the Acorn RISC OS commands of the same name.
I'm sure you were wondering.

=head1 LICENCE AND COPYRIGHT

Copyright (c) 2007, Andy Armstrong C<< <andy@hexten.net> >>.

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.



( run in 1.698 second using v1.01-cache-2.11-cpan-98e64b0badf )