Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > arrow key bindings in perl debugger mode

Reply
Thread Tools

arrow key bindings in perl debugger mode

 
 
andrew
Guest
Posts: n/a
 
      05-14-2008
Hi. I've been pouring over the debugger perldocs trying to figure out
how to change keyboard bindings, so for example the 'left' and 'right'
arrow keys let me move the cursor around the current line instead of
spitting out things like '^[[C', and mapping the 'up' arrow key to
cycle through the command history like it would at a command line
prompt. Am I approaching this completely wrong? Any advice would be
welcome. Thanks
 
Reply With Quote
 
 
 
 
Jens Thoms Toerring
Guest
Posts: n/a
 
      05-14-2008
andrew <(E-Mail Removed)> wrote:
> Hi. I've been pouring over the debugger perldocs trying to figure out
> how to change keyboard bindings, so for example the 'left' and 'right'
> arrow keys let me move the cursor around the current line instead of
> spitting out things like '^[[C', and mapping the 'up' arrow key to
> cycle through the command history like it would at a command line
> prompt. Am I approaching this completely wrong? Any advice would be
> welcome. Thanks


From 'perldoc perldebug':

As shipped, the only command-line history supplied is a simplistic
one that checks for leading exclamation points. However, if you
install the Term::ReadKey and Term::ReadLine modules from CPAN,
you will have full editing capabilities much like GNU readline(3)
provides. Look for these in the modules/by-module/Term directory
on CPAN. These do not support normal vi command-line editing,
however.

And with ReadLine support also the left and right key should
work as expected.
Regards, Jens
--
\ Jens Thoms Toerring ___ http://www.velocityreviews.com/forums/(E-Mail Removed)
\__________________________ http://toerring.de
 
Reply With Quote
 
 
 
 
andrew
Guest
Posts: n/a
 
      05-15-2008
My sincerest thanks
 
Reply With Quote
 
andrew
Guest
Posts: n/a
 
      05-15-2008
Hmm, these two modules are installed, but it's not exactly clear to me
how to use them to customize key bindings.
 
Reply With Quote
 
Jens Thoms Toerring
Guest
Posts: n/a
 
      05-15-2008
andrew <(E-Mail Removed)> wrote:
> Hmm, these two modules are installed, but it's not exactly clear to me
> how to use them to customize key bindings.


Since readline is used you can customize keybindings by creating
a .inputrc file in your home directory (or set up the INPUTRC
environment variable to the name of the init file for readline)
and putting the keybindings in there. Per default more-or-less
emacs keybindings are used. In that file you can change them.
It's admittedly not trivial (unless you're an emacs expert)
but see e.g.

http://tiswww.case.edu/php/chet/read...rman.html#SEC9

Regards, Jens
--
\ Jens Thoms Toerring ___ (E-Mail Removed)
\__________________________ http://toerring.de
 
Reply With Quote
 
Jens Thoms Toerring
Guest
Posts: n/a
 
      05-15-2008
Jens Thoms Toerring <(E-Mail Removed)> wrote:
> andrew <(E-Mail Removed)> wrote:
> > Hmm, these two modules are installed, but it's not exactly clear to me
> > how to use them to customize key bindings.


> Since readline is used you can customize keybindings by creating
> a .inputrc file in your home directory (or set up the INPUTRC
> environment variable to the name of the init file for readline)
> and putting the keybindings in there. Per default more-or-less
> emacs keybindings are used. In that file you can change them.
> It's admittedly not trivial (unless you're an emacs expert)
> but see e.g.


> http://tiswww.case.edu/php/chet/read...rman.html#SEC9


You should be aware that using .inputrc in your home directory
also sets the keybindings also for all other programs that use
the readline library (e.g. xterm). The simplest way around that
is probably to create an alias like (bash style)

alis pd='INPUTRC=~/.perldinputrc perl -d'

so that the INPUTRC variable gets only set to the file with
eybindings for the debugger, named here .perldinputrc in
your home directory, when you start perl in debug mode with
the new "command" 'pd'.
Regards, Jens
--
\ Jens Thoms Toerring ___ (E-Mail Removed)
\__________________________ http://toerring.de
 
Reply With Quote
 
Michael Carman
Guest
Posts: n/a
 
      05-15-2008
andrew wrote:
> Hmm, these two modules are installed, but it's not exactly clear to me
> how to use them to customize key bindings.


Something else must be wrong, then. The default bindings for those keys
matches the functionality you wanted.

-mjc
 
Reply With Quote
 
Andrew DeFaria
Guest
Posts: n/a
 
      05-16-2008
Jens Thoms Toerring wrote:
> You should be aware that using .inputrc in your home directory also
> sets the keybindings also for all other programs that use
> the readline library (e.g. xterm). The simplest way around that is
> probably to create an alias like (bash style)
>
> alis pd='INPUTRC=~/.perldinputrc perl -d'
>
> so that the INPUTRC variable gets only set to the file with eybindings
> for the debugger, named here .perldinputrc in your home directory,
> when you start perl in debug mode with the new "command" 'pd'.

Why in the world would I want the Perl debugger to behave one way and
bash another?
--
Andrew DeFaria <http://defaria.com>
Everybody repeat after me ...We are all individuals.

 
Reply With Quote
 
Jens Thoms Toerring
Guest
Posts: n/a
 
      05-16-2008
Andrew DeFaria <(E-Mail Removed)> wrote:
> [-- text/plain, encoding 7bit, charset: ISO-8859-1, 17 lines --]


> Jens Thoms Toerring wrote:
> > You should be aware that using .inputrc in your home directory also
> > sets the keybindings also for all other programs that use
> > the readline library (e.g. xterm). The simplest way around that is
> > probably to create an alias like (bash style)
> >
> > alis pd='INPUTRC=~/.perldinputrc perl -d'
> >
> > so that the INPUTRC variable gets only set to the file with eybindings
> > for the debugger, named here .perldinputrc in your home directory,
> > when you start perl in debug mode with the new "command" 'pd'.

> Why in the world would I want the Perl debugger to behave one way and
> bash another?


Maybe because you want to assign to some function keys an
action that doesn't make sense in an xterm? Like e.g. assigning
the debuggers 'q' command to F12 while the same function key
should emit 'exit' in an xterm?

--
\ Jens Thoms Toerring ___ (E-Mail Removed)
\__________________________ http://toerring.de
 
Reply With Quote
 
Andrew DeFaria
Guest
Posts: n/a
 
      05-17-2008
Jens Thoms Toerring wrote:
>> Why in the world would I want the Perl debugger to behave one way and
>> bash another?

> Maybe because you want to assign to some function keys an action that
> doesn't make sense in an xterm? Like e.g. assigning
> the debuggers 'q' command to F12 while the same function key should
> emit 'exit' in an xterm?

Well I don't use xterm. But the answer is - I wouldn't. I wouldn't
bother assigning a function key (F12) to do the "q" command to quit the
debugger when the "q" key is right within grasp (of a touch typist, one
for over 25 years and a guitarist for 30 which great control of my
fingers) and the F12 is a stretch at best!
--
Andrew DeFaria <http://defaria.com>
The hilarious thing about self-important self-righteous people is that
they are so easily baited.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrow Key Navigation in Datagrid... Bob Morvay ASP .Net 1 09-07-2006 03:03 AM
Arrow key functionality in the ButtonGroup srinivas.veeranki@gmail.com Java 1 07-27-2006 09:50 AM
How to read arrow key input in the ANSI way? Paramesh C Programming 65 11-12-2005 02:35 AM
linux-python arrow-key problem when in interactive interpreter Gabriel Cooper Python 1 04-27-2004 08:05 PM
Perl debugger no longer lets me arrow up and down JS Bangs Perl Misc 1 07-09-2003 07:29 AM



Advertisments