{ local *STDOUT = NoPrint->new; print "foo\n" or warn "print failed (1)"; } print "foo\n" or warn "print failed (2)";