'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.



Solution 1:[1]

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

Solution 2:[2]

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:

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

Solution 3:[3]

This is what helped me on Debian stretch

apt install libterm-readline-gnu-perl

Solution 4:[4]

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

Solution 5:[5]

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

Solution 6:[6]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ozcoder
Solution 2
Solution 3 smonff
Solution 4 Dirk Heumann
Solution 5 civelldr
Solution 6 talkloud