Copyright (C) 2000-2012 |
Manpages Term::ReadLineSection: Perl Programmers Reference Guide (3perl)Updated: 2001-02-22 Index Return to Main Contents NAMETerm::ReadLine - Perl interface to various "readline" packages. If no real package is found, substitutes stubs instead of basic functions.SYNOPSISuse Term::ReadLine; $term = new Term::ReadLine 'Simple Perl calc'; $prompt = "Enter your arithmetic expression: "; $OUT = $term->OUT || STDOUT; while ( defined ($_ = $term->readline($prompt)) ) { $res = eval($_), "\n"; warn $@ if $@; print $OUT $res, "\n" unless $@; $term->addhistory($_) if /\S/; } DESCRIPTIONThis package is just a front end to some other packages. At the moment this description is written, the only such package is Term-ReadLine, available on CPAN near you. The real target of this stub package is to set up a common interface to whatever Readline emerges with time.Minimal set of supported functionsAll the supported functions should be called as methods, i.e., either as
$term = new Term::ReadLine 'name';or as
$term->addhistory('row');where $term is a return value of Term::ReadLine->Init.
Additional supported functionsActually "Term::ReadLine" can use some other package, that will support reacher set of commands.All these commands are callable via method interface and have names which conform to standard conventions with the leading "rl_" stripped. The stub package included with the perl distribution allows some additional methods:
One can check whether the currently loaded ReadLine package supports these methods by checking for corresponding "Features". EXPORTSNoneENVIRONMENTThe environment variable "PERL_RL" governs which ReadLine clone is loaded. If the value is false, a dummy interface is used. If the value is true, it should be tail of the name of the package to use, such as "Perl" or "Gnu".As a special case, if the value of this variable is space-separated, the tail might be used to disable the ornaments by setting the tail to be "o=0" or "ornaments=0". The head should be as described above, say If the variable is not set, or if the head of space-separated list is empty, the best available package is loaded.
export "PERL_RL=Perl o=0" # Use Perl ReadLine without ornaments export "PERL_RL= o=0" # Use best available ReadLine without ornaments(Note that processing of "PERL_RL" for ornaments is in the discretion of the particular used "Term::ReadLine::*" package).
Index
This document was created by man2html, using the manual pages. Time: 15:15:35 GMT, April 19, 2024 |