my $Test = Test::Builder->new; my @handle_names = qw/ output failure_output todo_output /; my %old; $old{$_} = $Test->$_ for @handle_names; $Test->$_(\*STDOUT) for @handle_names; eval { run_your_tests }; # and restore: $Test->$_($old{$_}) for @handle_names;