develooper Front page | perl.perl5.porters | Postings from January 2004

[PATCH] Don't close STDOUT/STDERR in docs (well, almost never)

From:
Chip Salzenberg
Date:
January 30, 2004 10:47
Subject:
[PATCH] Don't close STDOUT/STDERR in docs (well, almost never)
Message ID:
20040130183420.GA169@perlsupport.com
This doc patch eliminates unnecessary explicit closes of STDOUT and
STDERR.  We shouldn't be telling people they have to close a handle
before reopening it, especially since if they do it naively they may
lose diagnostic messages.

(BTW, It's extraordinarily funky that you *do* have to close STDOUT
before C<open STDOUT, '>', \$var>.  OTOH, doing that on STDOUT is just
stupid -- that's what C<select> is for!  So I guess I don't mind.)

==== //depot/perl/pod/perlfork.pod#9 - /u/projects/perl/current/pod/perlfork.pod ====
@@ -209,5 +209,4 @@
 	# child
 	while (<STDIN>) { print; }
-	close STDIN;
 	exit(0);
     }
@@ -239,5 +238,4 @@
 	# child
 	print "pipe_from_fork\n";
-	close STDOUT;
 	exit(0);
     }
==== //depot/perl/pod/perlfunc.pod#424 - /u/projects/perl/current/pod/perlfunc.pod ====
@@ -2988,7 +2988,4 @@
     print STDERR "stderr 1\n"; 	# subprocesses too
 
-    close STDOUT;
-    close STDERR;
-
     open STDOUT, ">&", $oldout or die "Can't dup \$oldout: $!";
     open STDERR, ">&OLDERR"    or die "Can't dup OLDERR: $!";

-- 
Chip Salzenberg               - a.k.a. -               <chip@pobox.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early."  // MST3K



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About