my $ptty=$ARGV[0]; if ($ENV{INSIDE_EMACS}) { my $tty=`tty`; delete $ENV{INSIDE_EMACS}; warn "restart in xterm $0 $tty\n"; my $x=`xterm -e '/usr/bin/perl $0 $tty'`; warn "xterm closed\n"; exit; } elsif ($ptty) { close STDERR; open STDERR,">",$ptty; local $\="\n"; warn "redirecting STDERR to $ptty\n"; $|=1; }