According to the documentation the package is just a front end to some other packages. It's a stub to set up a common interface to the various ReadLine implementations found on CPAN (under the Term::ReadLine::* namespace). If you haven't installed any additional packages like Term::Readline::Gnu or Term::ReadLine::EditLine, it will default to an internal default package called Term::ReadLine::Stub, this default package is very simple, and does not understand things like arrow keys. You can use $term->ReadLine to determine which package it is actually using, see below example.

I tried to install Term::ReadLine::Gnu on my Ubuntu laptop:

$ sudo apt-get install libncurses5-dev libreadline6-dev $ cpanm Term::ReadLine::Gnu
Then I tried
use feature qw(say); use strict; use warnings; use Term::ReadLine; my $term = Term::ReadLine->new('Test', \*STDIN, \*STDOUT); say "I am using the following ReadLine package: " . $term->ReadLine; $term->ornaments( 0 ); $term->addhistory("sample text added to history"); while (1) { my $line = $term->readline( 'Enter input: ' ); say "You entered: '$line'"; }

Now the up and down arrow keys are recoginzed, and used to recall the history lines. There are also some useful Emacs keybindings available, see Command Line Editing in the Gnu Bash manual for more information.


In reply to Re: Revising Input Method by hakonhagland
in thread Revising Input Method by PinePerl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.