From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kai.grossjohann@uni-duisburg.de (Kai =?iso-8859-1?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.help Subject: Re: Emacs like line editing during perl input. Date: Tue, 31 Dec 2002 16:14:54 +0100 Organization: University of Dortmund, Germany Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <8465tajk41.fsf@lucy.cs.uni-dortmund.de> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1041347931 22495 80.91.224.249 (31 Dec 2002 15:18:51 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 31 Dec 2002 15:18:51 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18TOAL-0005qZ-00 for ; Tue, 31 Dec 2002 16:18:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18TO7J-0002lw-0D for gnu-help-gnu-emacs@m.gmane.org; Tue, 31 Dec 2002 10:15:41 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!p50877dc3.dip.t-dialin.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-NNTP-Posting-Host: p50877dc3.dip.t-dialin.net (80.135.125.195) Original-X-Trace: fu-berlin.de 1041347704 10419269 80.135.125.195 (16 [73968]) User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu) Cancel-Lock: sha1:kjVVxBwbv6C7ADrIIsKBow5llQo= Original-Xref: shelby.stanford.edu gnu.emacs.help:108624 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5153 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5153 Harry Putnam writes: > I'd like to have somekind of line editing available during user > input to a perl script. Here is an example program using Term::ReadLine that worked for me. #!/usr/sw/perl/default/bin/perl -w use Term::ReadLine; my $t = Term::ReadLine->new('Do nothing'); my $inp = ''; # input from user print "Type quit to quit.\n"; do { $inp = $t->readline("> "); } while ( $inp ne 'quit' ); exit 0; Don't forget to change the first line. It's really as easy as calling $x->readline($prompt) to read a line after creating the Term::ReadLine object $x. -- Ambibibentists unite!