How To activate command line history in debugger?

  • Thread starter Kurt Kronschnabl
  • Start date
K

Kurt Kronschnabl

Hi all,


does anybody know how to enable the command line history in the debugger?

Under Suse 8.2 is it already active. Not under Knoppix 3.1/3.2.

I am a newbie in perl and don't understand the explanation in "man
perldeb" to install Term::ReadKey and Term::Readline. I tried to create
the file .perldb in ~ with the content
use Term::ReadKey;
use Term::Readline;
but this does not enable the history feature. BTW in the perl lib dirs
is a ReadLine.pm but no a ReadKey.

Any hints are appreciated.

Regards, Kurt
 
D

Daniel Pfeiffer

Saluton, Moin,

Kurt Kronschnabl said:
does anybody know how to enable the command line history in the debugger?

Under Suse 8.2 is it already active. Not under Knoppix 3.1/3.2.

I am a newbie in perl and don't understand the explanation in "man
perldeb" to install Term::ReadKey and Term::Readline.

Versuch's stattdessen mit Emacs M-x shell (M- heißt normalerweise Alt-Taste). Das gibt Dir eine Art Terminal in einem Emacs Puffer. Wenn Du auf der letzten Zeile nach dem Prompt Return, M-p oder M-n benutzt ist das, das was Du brauchst. Du hast aber auch die ganze Interaktion im Puffer, und kannst von dort Befehle nochmal abschicken oder das ganze sogar editieren :)

coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
Daniel Pfeiffer

-- GPL 3: take the wind out of Palladium's sails! --
 
K

Kurt Kronschnabl

Daniel said:
Versuch's stattdessen mit Emacs M-x shell (M- heißt normalerweise Alt-Taste). Das gibt Dir eine Art Terminal in einem Emacs Puffer. Wenn Du auf der letzten Zeile nach dem Prompt Return, M-p oder M-n benutzt ist das, das was Du brauchst. Du hast aber auch die ganze Interaktion im Puffer, und kannst von dort Befehle nochmal abschicken oder das ganze sogar editieren :)

Sounds good, but please give me a hint how to activate this? Do I need
to create a .perldb file?

Regards, Kurt
 
D

Daniel Pfeiffer

Saluton, Moin,

Kurt Kronschnabl said:
Sounds good, but please give me a hint how to activate this? Do I need
to create a .perldb file?

M-x shell
$ perl -d /tmp/randloop

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(/tmp/randloop:3): while( sleep 1 ) {
DB<1> s
main::(/tmp/randloop:4): print ':', rand(), "\n";
DB<1> s
:0.530385083825426
main::(/tmp/randloop:3): while( sleep 1 ) {
DB<1> s
main::(/tmp/randloop:4): print ':', rand(), "\n";
DB<1> s
:0.668097208810167
main::(/tmp/randloop:3): while( sleep 1 ) {
DB<1> q
$

(with highlighting for the prompts :) When you hit Return at the end of buffer, everything after the prompt gets sent. On Return elsewhere, the command on that line first gets copied to the end.

coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
Daniel Pfeiffer

-- GPL 3: take the wind out of Palladium's sails! --
 
K

Kurt Kronschnabl

Daniel Pfeiffer schrieb:

Hi Daniel,
M-x shell

Sorry "I am standing on the hose" :=) What do you mean with this line
and the Debug session?
(with highlighting for the prompts :)
When you hit Return at the end of buffer,
everything after the prompt gets sent.
On Return elsewhere,
the command on that line first gets copied to the end.

This sounds good again, but again: How to do?

Regards, Kurt
 
P

Peter Scott

does anybody know how to enable the command line history in the debugger?

Under Suse 8.2 is it already active. Not under Knoppix 3.1/3.2.

I am a newbie in perl and don't understand the explanation in "man
perldeb" to install Term::ReadKey and Term::Readline. I tried to create
the file .perldb in ~ with the content
use Term::ReadKey;
use Term::Readline;
but this does not enable the history feature. BTW in the perl lib dirs
is a ReadLine.pm but no a ReadKey.

You need to install the missing module. Become root and type

perl -MCPAN -e 'install Term::ReadKey'

If you have never run CPAN.pm before there will be a slew of questions
to answer that should be self explanatory.

Without this module Perl has no mechanism to intercept the arrow key
presses and interpret them as requests to traverse the command line history.
 
K

Kurt Kronschnabl

Peter said:
perl -MCPAN -e 'install Term::ReadKey'

If you have never run CPAN.pm before there will be a slew of questions
to answer that should be self explanatory.

Without this module Perl has no mechanism to intercept the arrow key
presses and interpret them as requests to traverse the command line history.

Hi Peter,

yet today I visited the NG after longer time again. Thank you very much!
That's it what I have searched for!!

Best regards, Kurt
 
K

Kurt Kronschnabl

Peter said:
You need to install the missing module. Become root and type

perl -MCPAN -e 'install Term::ReadKey'

Hello Peter,

I am afraid I have to install more then ReadKey. What I get is:

knoppix@p01kno:~$ perl -MCPAN -e 'install Term::ReadKey'
Can't locate object method "install" via package "Term::ReadKey" at -e
line 1.

Could you please give me an idea what is missing?

The Output of perl -V is as follows:

knoppix@p01kno:~$ perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.19, archname=i386-linux-thread-multi
uname='linux cyberhq 2.4.19 #1 smp sun aug 4 11:30:45 pdt 2002 i686
unknown unknown gnulinux '
config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN
-Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr
-Dprivlib=/usr/share/perl/5.8.0 -Darchlib=/usr/lib/perl/5.8.0
-Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5
-Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local
-Dsitelib=/usr/local/share/perl/5.8.0
-Dsitearch=/usr/local/lib/perl/5.8.0 -Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl
-Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm
-Duseshrplib -Dlibperl=libperl.so.5.8.0 -Dd_dosuid -des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN
-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O3',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing'
ccversion='', gccversion='3.2.2', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt
perllibs=-ldl -lm -lpthread -lc -lcrypt
libc=/lib/libc-2.3.1.so, so=so, useshrplib=true,
libperl=libperl.so.5.8.0
gnulibc_version='2.3.1'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Feb 17 2003 12:38:57
@INC:
/etc/perl
/usr/local/lib/perl/5.8.0
/usr/local/share/perl/5.8.0
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8.0
/usr/share/perl/5.8.0
/usr/local/lib/site_perl

The onliest pm is /usr/share/perl/5.8.0/Term/ReadLine.pm and
/usr/share/perl5/Debconf/FrontEnd/Readline.pm but no ReadKey. This is
the case as well for suse 8.2. And there the history works perfect.

I am not (yet!) so familiar with perl packages and their installation

Best regards,

Kurt
 
P

Peter Scott

Hello Peter,

I am afraid I have to install more then ReadKey. What I get is:

knoppix@p01kno:~$ perl -MCPAN -e 'install Term::ReadKey'
Can't locate object method "install" via package "Term::ReadKey" at -e
line 1.

Could you please give me an idea what is missing?

That's odd. That means that Term::ReadKey is already installed.
(You could get around that error to update it via CPAN.pm with
perl -MCPAN -e shell
install Term::ReadKey
but that is not the point.)

Let's make certain whether you have that module or not. Send the output of:

perl -MTerm::ReadKey -e 0
perl -dle 'print $INC{"Term/ReadKey.pm"}' # Then type 'c'
perl -MCPAN -le 'print $INC{"Term/ReadKey.pm"}'

I am having a hard time seeing how the same perl as gave you the debugger
problem can give you that output. Are you sure that root doesn't have a
different path causing it to run a different perl?
The Output of perl -V is as follows: [snip]

The onliest pm is /usr/share/perl/5.8.0/Term/ReadLine.pm and
/usr/share/perl5/Debconf/FrontEnd/Readline.pm but no ReadKey. This is
the case as well for suse 8.2. And there the history works perfect.
 
K

Kurt Kronschnabl

Hello Peter.

As already told, there is no "ReadKey.pm" in a Knoppix and Suse 8.2
installation. ReadLine is available in both distries. But only under
Suse it works.

Here the results for ReadKey:

knoppix@p01kno:~$ perl -MTERM::ReadKey -e 0
Can't locate TERM/ReadKey.pm in @INC (@INC contains: /etc/perl
/usr/local/lib/perl/5.8.0 /usr/local/share/perl/5.8.0 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.8.0 /usr/share/perl/5.8.0
/usr/local/lib/site_perl .).
BEGIN failed--compilation aborted.

knoppix@p01kno:~$ perl -dle 'print $INC{"Term/ReadKey.pm"}'

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1): print $INC{"Term/ReadKey.pm"}
DB<1> c

Debugged program terminated. Use q to quit or R to restart,
use O inhibit_exit to avoid stopping after program termination,
h q, h R or h O to get additional info.
DB<1>

knoppix@p01kno:~$ perl -MCPAN -le 'print $INC{"Term/ReadKey.pm"}'

knoppix@p01kno:~$
Are you sure that root doesn't have a
different path causing it to run a different perl?

Yes, very shure. Under root it is the same effect.

And here the results for ReadLine:

knoppix@p01kno:~$ perl -dle 'print $INC{"Term/ReadKey.pm"}'

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1): print $INC{"Term/ReadKey.pm"}
DB<1> c

Debugged program terminated. Use q to quit or R to restart,
use O inhibit_exit to avoid stopping after program termination,
h q, h R or h O to get additional info.
DB<1> q
knoppix@p01kno:~$ perl -MCPAN -le 'print $INC{"Term/ReadKey.pm"}'

knoppix@p01kno:~$ perl -MTERM::ReadLine -e 0
Can't locate TERM/ReadLine.pm in @INC (@INC contains: /etc/perl
/usr/local/lib/perl/5.8.0 /usr/local/share/perl/5.8.0 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.8.0 /usr/share/perl/5.8.0
/usr/local/lib/site_perl .).
BEGIN failed--compilation aborted.
knoppix@p01kno:~$ perl -dle 'print $INC{"Term/ReadLine.pm"}'

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1): print $INC{"Term/ReadLine.pm"}
DB<1> c
/usr/share/perl/5.8.0/Term/ReadLine.pm
Debugged program terminated. Use q to quit or R to restart,
use O inhibit_exit to avoid stopping after program termination,
h q, h R or h O to get additional info.
DB<1> q
knoppix@p01kno:~$ perl -MCPAN -le 'print $INC{"Term/ReadLine.pm"}'

knoppix@p01kno:~$

Hope this tells you more than me :=)

Best Regards, Kurt
 
P

Peter Scott

Kurt Kronschnabl said:
Hello Peter.

As already told, there is no "ReadKey.pm" in a Knoppix and Suse 8.2
installation. ReadLine is available in both distries. But only under
Suse it works.

My news server spasmed and dropped this thread from its spool, and I didn't
see any reply to my emails to you. Install Term::ReadKey as root with

perl -MCPAN -e shell
CPAN> install Term::ReadKey
CAPAN> q

and email me if that doesn't fix the problem.
 
K

Kurt Kronschnabl

My news server spasmed and dropped this thread from its spool, and I didn't
see any reply to my emails to you. Install Term::ReadKey as root with

perl -MCPAN -e shell
CPAN> install Term::ReadKey
CAPAN> q

and email me if that doesn't fix the problem.

ok, here my reply from 10/01/03 once again:

Hello Peter.

As already told, there is no "ReadKey.pm" in a Knoppix and Suse 8.2
installation. ReadLine is available in both distries. But only under
Suse it works.

Here the results for ReadKey:

knoppix@p01kno:~$ perl -MTERM::ReadKey -e 0
Can't locate TERM/ReadKey.pm in @INC (@INC contains: /etc/perl
/usr/local/lib/perl/5.8.0 /usr/local/share/perl/5.8.0 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.8.0 /usr/share/perl/5.8.0
/usr/local/lib/site_perl .).
BEGIN failed--compilation aborted.

knoppix@p01kno:~$ perl -dle 'print $INC{"Term/ReadKey.pm"}'

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1): print $INC{"Term/ReadKey.pm"}
DB<1> c

Debugged program terminated. Use q to quit or R to restart,
use O inhibit_exit to avoid stopping after program termination,
h q, h R or h O to get additional info.
DB<1>

knoppix@p01kno:~$ perl -MCPAN -le 'print $INC{"Term/ReadKey.pm"}'

knoppix@p01kno:~$
Are you sure that root doesn't have a
different path causing it to run a different perl?


Yes, very shure. Under root it is the same effect.

And here the results for ReadLine:

knoppix@p01kno:~$ perl -dle 'print $INC{"Term/ReadKey.pm"}'

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1): print $INC{"Term/ReadKey.pm"}
DB<1> c

Debugged program terminated. Use q to quit or R to restart,
use O inhibit_exit to avoid stopping after program termination,
h q, h R or h O to get additional info.
DB<1> q
knoppix@p01kno:~$ perl -MCPAN -le 'print $INC{"Term/ReadKey.pm"}'

knoppix@p01kno:~$ perl -MTERM::ReadLine -e 0
Can't locate TERM/ReadLine.pm in @INC (@INC contains: /etc/perl
/usr/local/lib/perl/5.8.0 /usr/local/share/perl/5.8.0 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.8.0 /usr/share/perl/5.8.0
/usr/local/lib/site_perl .).
BEGIN failed--compilation aborted.
knoppix@p01kno:~$ perl -dle 'print $INC{"Term/ReadLine.pm"}'

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1): print $INC{"Term/ReadLine.pm"}
DB<1> c
/usr/share/perl/5.8.0/Term/ReadLine.pm
Debugged program terminated. Use q to quit or R to restart,
use O inhibit_exit to avoid stopping after program termination,
h q, h R or h O to get additional info.
DB<1> q
knoppix@p01kno:~$ perl -MCPAN -le 'print $INC{"Term/ReadLine.pm"}'

knoppix@p01kno:~$

Hope this tells you more than me :=)

Best Regards, Kurt
 
P

Peter Scott

Peter said:
Install Term::ReadKey as root with

perl -MCPAN -e shell
CPAN> install Term::ReadKey
CPAN> q

and email me if that doesn't fix the problem.
ok, here my reply from 10/01/03 once again:

Hello Peter.

As already told, there is no "ReadKey.pm" in a Knoppix and Suse 8.2
installation. ReadLine is available in both distries. But only under
Suse it works. [snip]

Please read what I wrote. I know Term::ReadKey isn't on your system.
I told you how to install it. Install it.
 
K

Kurt Kronschnabl

Peter said:
I told you how to install it.

Sorry it seems that I misunderstood something.

You wrote "You could get round that error" ... "but that is not the
point." Therefore I didn't try the comamnd.

But now I tried it. But we have an Socks Proxy here running, Therefore

CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz

does not work.

But I downloaded ReadKey.pm from the CPAN site and saved and changed the
owner:group to root the file in /usr/share/perl/5.8.0/Term which is part
on @INC.

Is there another way nessecary to make perl the new module known?

Regards,

Kurt
 
P

Peter Scott

But we have an Socks Proxy here running, Therefore

CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz

does not work.

CPAN.pm lets you use a proxy. Look in its documentation for

o conf http_proxy ...
But I downloaded ReadKey.pm from the CPAN site and saved and changed the
owner:group to root the file in /usr/share/perl/5.8.0/Term which is part
on @INC.

That is not the way to install a CPAN module. It may work in some cases,
but not others. And it won't work in this case because there is a XS
component that needs to be compiled into a shared library.
Is there another way nessecary to make perl the new module known?

FTP to ftp.cpan.org, navigate to the module required, download the .tar.gz
file, then:

tar zxf TermReadKey-2.21.tar.gz
cd TermReadKey-2.21
perl Makefile.PL
make test
make install
 
K

Kurt Kronschnabl

Hello Peter,

Peter said:
tar zxf TermReadKey-2.21.tar.gz
cd TermReadKey-2.21
perl Makefile.PL
make test
make install

I got the tar file (http://www.cpan.org/authors/id/J/JS/JSTOWE/ is a
http source I found) and everthing ran without any error.

A simple test with a degbug session (perl -d)showed me unfortunaltely no
success. It's still displaying the ESC-Sequence of Up-arrow.

Could I check or do something else?

If you would have a little bit of time ;=) it would be a way for you to
boot a Knoppix CD to see the effect live.

Regards, Kurt
 
P

Peter Scott

I am not going to reply again on this thread unless you post with an address
that will accept email. I just wasted a bunch of time replying to your
posted address, reading the bounce, resending without the "-nospam", and
reading the bounce from that.

I got the tar file (http://www.cpan.org/authors/id/J/JS/JSTOWE/ is a
http source I found) and everthing ran without any error.

A simple test with a degbug session (perl -d)showed me unfortunaltely no
success. It's still displaying the ESC-Sequence of Up-arrow.

Could I check or do something else?

Maybe it's something wrong with your terminal settings. Write a small
application that uses Term::ReadKey and run it fom the same shell that
you're running the debugger to see if it works properly.

Also, see whether the debugger loaded the module properly. Do

perl -de 0

and type

x \%INC

Check that the output includes entries for ReadLine and ReadKey.
If you would have a little bit of time ;=)

I do not.
it would be a way for you to boot a Knoppix CD to see the effect live.

Hardly guaranteed, unless you know of other Knoppix users with the same
problem, in which case you should file a bug report.
 
K

Kurt Kronschnabl

Peter said:
I just wasted a bunch of time replying to your
posted address, reading the bounce, resending without the "-nospam", and
reading the bounce from that.

It's indeed my fault. i just saw my miswritten address. I am very sorry
about that, because you are so engaged to help me. I corrected it now.
But I must include the nospam string in it. I hope you understand this.
Maybe it's something wrong with your terminal settings. Write a small
application that uses Term::ReadKey and run it fom the same shell that
you're running the debugger to see if it works properly.

I'll do this.
Also, see whether the debugger loaded the module properly. Do

perl -de 0

and type

x \%INC

That's really interesting: The result is:

DB<3> x \$INC
0 SCALAR(0x813a9f0)
-> undef

BUT: $INC has a content with perl -V:

/etc/perl
/usr/local/lib/perl/5.8.0
/usr/local/share/perl/5.8.0
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8.0
/usr/share/perl/5.8.0
/usr/local/lib/site_perl

Hardly guaranteed, unless you know of other Knoppix users with the same
problem, in which case you should file a bug report.

It's a bug report worth in every case.

In the case of Java the environment variable JAVA_HOME has been missing
set. Does perl need a certain one as well? I did'nt discover any under Suse.

Regards, Kurt
 
K

Kurt Kronschnabl

Finally I found a solution for Knoppix 3.2 with Pater Scotts help:

First I installed Readline from
http://search.cpan.org/~ilyaz/Term-ReadLine-Perl-1.0203/

Then ReadKey didn't work not yet (Error message after instaling) inspite
of ReadKey.pm has been in the Lib path ($INC). But the history worked
already.

To get rid of the ReadLine Error message I reinstalled Term::ReadKey
interactive via "perl -MCPAN -e shell". Now it works perfect!

Regards, Kurt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top