replace _print_immediately with IO::Handle