NAME Test::Resub - Lexically scoped subroutine replacement, primarily for unit testing SYNOPSIS use Test::More tests => 4; use Test::Resub qw(resub); { package Somewhere; sub show { my ($class, $message) = @_; return "$class, $message"; } } # sanity is( Somewhere->show('beyond the sea'), 'Somewhere, beyond the sea' ); # scoped replacement of subroutine with argument capturing { my $rs = resub 'Somewhere::show', sub { 'hi' }, capture => 1; is( Somewhere->show('over the rainbow'), 'hi' ); is_deeply( $rs->method_args, [['over the rainbow']] ); } # scope ends, resub goes away, original code returns is( Somewhere->show('waiting for me'), 'Somewhere, waiting for me' ); DESCRIPTION This module allows you to temporarily replace a subroutine/method with arbitrary code. Later, you can tell how many times was it called and with what arguments each time. You can also specify that the subrou- tine/method must get called, must not get called, or may be optionally called. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Test::Resub You can also look for information at: Search CPAN http://search.cpan.org/dist/Test-Resub CPAN Request Tracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Resub AnnoCPAN, annotated CPAN documentation: http://annocpan.org/dist/Test-Resub CPAN Ratings: http://cpanratings.perl.org/d/Test-Resub COPYRIGHT AND LICENCE Copyright (C) 2007 AirWave Wireless, Inc This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.