Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!usc!cs.utexas.edu!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: pager pipes Message-ID: <1991Feb16.210445.7760@convex.com> Date: 16 Feb 91 21:04:45 GMT Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 20 Nntp-Posting-Host: pixel.convex.com I was trying to set up an automatic pager for STDOUT, and it doesn't seem to work. If I choose a different handle, it's fine. Any clues? $pager = $ENV{'PAGER'} || 'more'; open(STDOUT, "| $pager") || die "can't reopen STDOUT to $pager: $!"; open(STDERR, ">&PIPE") || die "dup failed: $!"; system 'ps t'; system 'grep nada nonesuch'; while (<>) { print; } close(STDOUT) || die "close failed: $!"; Notice that I never die of a bad dup even though there is no PIPE handle. If you %s/STDOUT/PIPE/g and add an appropriate select, it all works fine. This is under both 3.044 and 4.0beta. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "All things are possible, but not all expedient." (in life, UNIX, and perl)