Arrow up and down does not work any more in Perl debugger and CPAN client
Asked Answered
E

7

17

I used to use Active Perl on my Mac OS X (v 10.7.5) and then I switched to the one provided via mac ports (v 5.12.4).

Now when I run the CPAN client or the perl debugger, I cannot access the history using ArrowUp and ArrowDown, what is shown at the prompt is ^[[A and ^[[B respectively.

At least on the debugger the history works, I can access past commands via !num.

Evelineevelinn answered 9/12, 2012 at 0:13 Comment(0)
H
40

By default the only Term::ReadLine handler you get is Term::ReadLine::Perl which is quite simple and doesn't understand things like arrow keys. You probably want to install Term::ReadLine::Gnu.

Heather answered 9/12, 2012 at 0:14 Comment(3)
Thanks, it worked like a charm! I cannot upvote your answer because I don't have enough points, but I surely will!Evelineevelinn
On Ubuntu 14.04, cpanm Term::ReadLine::Gnu failed initially. Had to run sudo apt-get install libncurses5-dev libreadline6-dev first.Pika
This worked for me in OS X 10.9.5 with a perlbrewed 5.18.4. Thank you!Sabellian
S
4

If you want to avoid installing additional OS libraries (or need to because you don't have root/sudo) you can just use CPAN (as opposed to doing a system install with rpm or apt) to grab one of these two Perl implementations of Readline:

It's especially handy if you already have your own local Perl install (eg, using Perlbrew) where it won't want to use any system-installed modules.

Spiritualist answered 20/7, 2016 at 23:26 Comment(3)
Uh? I you want to avoid installing additional libraries, you need to install the following additional libraries?Justifier
@Justifier The difference is where they are installed, at the OS level, or just within the confines of Perl. You don't really need an rpm or deb for it. I've edited my answer to try to clarify the difference.Spiritualist
This helped me. cpan -f Term::ReadLine::Perl worked.Methoxychlor
B
3

Following on from the answers from LeoNerd and Hakon :- On CentOS 7 I had to run

sudo yum install perl-Term-ReadLine-Gnu

to install the module. Now the arrow keys work in perl -d

Beaconsfield answered 4/2, 2016 at 4:0 Comment(0)
P
2

This is what helped me on Debian stretch

apt install libterm-readline-gnu-perl
Paterfamilias answered 4/3, 2019 at 15:12 Comment(0)
L
1

For "git for Windows" you can do the following:

From

Ilya Zakharevich's package Term-ReadLine-Perl-1.0303

download the file

Term-ReadLine-Perl-1.0303.tar.gz

extract it with

tar xvzf ../Term-ReadLine-Perl-1.0303.tar.gz

Two files

Term-ReadLine-Perl-1.0303/ReadLine/Perl.pm
Term-ReadLine-Perl-1.0303/ReadLine/readline.pm

have to be copied typically with admin rights into the directory

C:/Program Files/Git/usr/share/perl5/site_perl/Term/ReadLine/

resulting in the two files

C:/Program Files/Git/usr/share/perl5/site_perl/Term/ReadLine/Perl.pm and
C:/Program Files/Git/usr/share/perl5/site_perl/Term/ReadLine/readline.pm

Afterwards you can use the cursor keys inside the perl debugger, for instance inside a "perl -de 0" session.

In the 64 bit git for Windows SDK, you usually have to copy the two files into directory

C:/git-sdk-64/usr/share/perl5/site_perl/Term/ReadLine
Logway answered 24/9, 2019 at 20:44 Comment(0)
W
0

What I ended up doing was changing the term of my 'Terminal' window to vt100 under the Preferences > Advanced

Wiedmann answered 2/9, 2015 at 0:22 Comment(1)
This did not help for me.Justifier
N
0

Here's what I had to do to get it working with Cygwin Perl

Install the following Cygwin packages:

libncurses-devel
libreadline-devel

Then install the Term::ReadLine::Gnu module from CPAN

Nymphet answered 20/2, 2018 at 18:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.