#!/usr/bin/perl

use 5.10.0;
use Test::MockModule;

@Bar::ISA = 'Foo';
@Baz::ISA = 'Bar';

sub Foo::motto { 'Foo!' };

say Foo->motto(), Bar->motto(), Baz->motto();

{
	my $mock_bar = new Test::MockModule('Bar', no_auto => 1);
	$mock_bar->mock('motto', sub { 'Bar!' });

	my $mock_baz = new Test::MockModule('Baz', no_auto => 1);
	$mock_baz->mock('motto', sub { 'Baz!' });

	say Foo->motto(), Bar->motto(), Baz->motto();
}

say Foo->motto(), Bar->motto(), Baz->motto();

