Randall Randall - 25 days ago 9
Perl Question

Perl debugger does not work with arrow keys under Perlbrew

I'd like arrow keys to work for command history in perl debugger. This solution looks good, so since I'm using ubuntu, I tried

sudo aptitude install libterm-readline-gnu-perl


But, I still get the
^[[A
and
^[[B
echoed back in the perl debugger instead of previous/next commands.

I have found this is specifically an issue within my
perlbrew
envinronment. If I run
/usr/bin/perl -d
the arrow keys do work (ie, the install fixed it only for that perl).

How do I get the debugger to work under perlbrew?

As a last-ditch effort, within my perlbrew environment I tried
cpanm Term::ReadLine::Gnu
but got the error


Could not find neither libtermcap.a, libncurses.a, or libcurses.


I could start installing more libraries, but it feels like I'm missing something else, since it's only a problem affecting Perlbrew.

Answer

Installing the packages @melpomene suggests does do the trick.

But I found another solution that does not require the dev packages (and, hence, does not require root). Either of the following CPAN packages can be used on their own:

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

Since Perlbrew is sometimes (often?) used in environments where you don't have root, this is probably a more convenient solution.

Comments