package Test::AutoMock; use base 'Test::MockObject'; # This is a stripped-down version of some of my own testing # code, so this is untested, but should work... sub dispatch_mocked_method { my $self = $_[0]; my $sub = splice( @_, 1, 1 ); my $subs = Test::MockObject::_subs( $self ); $self->log_call( $sub, @_ ); if ( exists $subs->{ $sub } ) { goto &{ $subs->{ $sub } }; } else { return 1; } }