Arrow up and down does not work any more in Perl d

2019-02-04 18:34发布

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.

5条回答
2楼-- · 2019-02-04 19:23

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.

查看更多
霸刀☆藐视天下
3楼-- · 2019-02-04 19:25

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

查看更多
劳资没心,怎么记你
4楼-- · 2019-02-04 19:30

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

查看更多
叛逆
5楼-- · 2019-02-04 19:34

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

查看更多
beautiful°
6楼-- · 2019-02-04 19:34

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

查看更多
登录 后发表回答