The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
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' };
           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.

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

    GitHub Request Tracker:
        https://github.com/belden/test-resub/issues

COPYRIGHT AND LICENCE

Copyright (C) 2012 Belden Lyman <belden@cpan.org>

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.