Term::ReadLine::Perl5 - A pure Perl implementation GNU Readline
use Term::ReadLine::Perl5; $term = new Term::ReadLine::Perl5 'ProgramName'; while ( defined ($_ = $term->readline('prompt>')) ) { ... }
This is a implementation of the GNU Readline/History Library written entirely in Perl.
GNU Readline reads lines from an interactive terminal with emacs or vi editing capabilities. It provides as mechanism for saving history of previous input.
This package typically used in command-line interfaces and REPLs (Read, Eval, Print Loops).
Term::ReadLine::Perl-new($name, [*IN, [*OUT])>
Term::ReadLine::Perl-
Returns a handle for subsequent calls to readline functions.
$name is the name of the application.
$name
Optionally you can add two arguments for input and output filehandles. These arguments should be globs.
This routine might also be called via Term::ReadLine-new($term_name)> if other Term::ReadLine packages like Term::ReadLine::Gnu is not available or if you have $ENV{PERL_RL} set to 'Perl';
Term::ReadLine-
$ENV{PERL_RL}
At present, because this code has lots of global state, we currently don't support more than one readline instance.
Somebody please volunteer to rewrite this code!
MinLine([$minlength])
If $minlength is given, set $readline::minlength the minimum length a $line for it to go into the readline history.
$minlength
$readline::minlength
The previous value is returned.
AddHistory($line1, ...)
Place @_ at the end of the history list unless the history is stifled, or there are already too many items.
clear_history()
Clear or reset readline history.
remove_history($which)
Remove history element $which from the history. The removed element is returned.
$which
replace_history_entry($which, $data)
Make the history entry at $which have $data. This returns the old entry. In the case of an invalid $which, $<undef> is returned.
$data
stifle_history($max)
Stifle or put a cap on thethe history list, remembering only $max number of lines.
$max
unstifle_history
Unstifle or remove limit the history list.
Theprevious maximum number of history entries is returned. The value is positive if the history was stifled and negative if it wasn't.
history_is_stifled
Returns true if saved history has a limited (stifled) or false if there is no limit (unstifled).
Jordan M. Adler Rocky Bernstein Ilya Zakharevich (Term::ReadLine::Perl) Jeffrey Friedl (Original Perl4 code)
To install Term::ReadLine::Perl5, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::ReadLine::Perl5
CPAN shell
perl -MCPAN -e shell install Term::ReadLine::Perl5
For more information on module installation, please visit the detailed CPAN module installation guide.