Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 854
agaved Avatar asked Dec 09 '12 00:12

agaved


4 Answers

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.

like image 56
LeoNerd Avatar answered Oct 20 '22 14:10

LeoNerd


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

like image 44
ozcoder Avatar answered Oct 20 '22 15:10

ozcoder


If you want to avoid installing additional OS libraries (or need to because you don't have root/sudo) you can just use CPAN to grab one of these two Perl implementations of Readline:

  • Term::ReadLine::Perl (Perl implementation of Readline libraries)
  • Term::Readline::Zoid (Pure Perl implementation of Readline libraries)

It's especially handy if you already have your own local Perl install (eg, using Perlbrew).

like image 3
Randall Avatar answered Oct 20 '22 14:10

Randall


This is what helped me on Debian stretch

apt install libterm-readline-gnu-perl
like image 2
Fazley Avatar answered Oct 20 '22 16:10

Fazley