in reply to Unit testing, context and wantarray

If your function call other function that should not be called in void context, try to locally redefine it.
sub Foo::bar { return 42; } say '1: ', Foo::bar; { no warnings 'redefine'; local *Foo::bar = sub { die }; eval { say '2: ', Foo::bar; }; } say '3: ', Foo::bar; __END__ 1: 42 3: 42