Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!othar From: othar@joliet.berkeley.edu (Othar Hansson) Newsgroups: comp.lang.perl Subject: Re: integrating GNU Readline and interactive perl scripts Message-ID: Date: 17 Jul 90 09:51:41 GMT References: Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: othar@guard.berkeley.edu Organization: CS Division, UC Berkeley Lines: 74 In-reply-to: othar@joliet.berkeley.edu's message of 14 Jul 90 10:58:24 GMT A few days ago, I posted a simple C program that lets you bring the GNU readline library into interactive perl scripts. Someone suggested that I try to do so for the debugger. The diff for perldb.pl ends this message. Briefly, this makes the perl debugger's command-line editing act somewhat like GDB. An initial test suggests that it clashes badly with an interactive program that uses the same technique, but perhaps that can be fixed. You can try it out by patching a copy of perldb.pl in, e.g., /tmp, and prefacing a script with: #!/usr/bin/perl -dI/tmp For those who missed the original msg, the Readline library allows users to edit the command line in the style of Ksh and Bash. I can email you gnureadline.c if you can't get the article out of your news feed. Othar Hansson CS Division, UC Berkeley ..!ucbvax!ernie!othar othar@ernie.berkeley.edu Script started on Tue Jul 17 02:18:45 1990 /tmp>diff -c perldb.pl /usr/local/lib/perl/perldb.pl *** perldb.pl Tue Jul 17 02:17:04 1990 --- /usr/local/lib/perl/perldb.pl Fri Dec 30 00:00:00 1988 *************** *** 25,39 **** # # ! $TTY=`tty`; ! chop $TTY; ! # open(IN,"/dev/tty"); # so we don't dingle stdin ! open(IN,"gnureadline ' (perldb) ' 2>$TTY |"); ! open(OUT,">/dev/tty"); # so we don't dongle stdout select(OUT); - printf "\n"; - $| = 1; # for DB'OUT select(STDOUT); $| = 1; # for real STDOUT --- 25,33 ---- # # ! open(IN,"/dev/tty"); # so we don't dingle stdin open(OUT,">/dev/tty"); # so we don't dongle stdout select(OUT); $| = 1; # for DB'OUT select(STDOUT); $| = 1; # for real STDOUT *************** *** 74,81 **** print OUT $#stack . " levels deep in subroutine calls!\n" if $single & 4; $start = $line; ! # while ((print OUT " DB<", $#hist+1, "> "), $cmd=) { ! while ($cmd=) { $single = 0; $signal = 0; $cmd eq '' && exit 0; --- 68,74 ---- print OUT $#stack . " levels deep in subroutine calls!\n" if $single & 4; $start = $line; ! while ((print OUT " DB<", $#hist+1, "> "), $cmd=) { $single = 0; $signal = 0; $cmd eq '' && exit 0; /tmp>exit script done on Tue Jul 17 02:21:21 1990