home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeJava and XSLTSearch this book

8.198. Term::ReadLine

Frontend to other ReadLine packages. Currently interfaces to Term-ReadLine, which is available on CPAN. Defines the variables $IN and $OUT, which return the filehandles for input and output, respectively, or undef if Readline input and output cannot be used for Perl. Provides the following methods.

new

$term = new Term::ReadLine 'name'

Constructor. Returns the handle for subsequent calls to other ReadLine methods. Argument name is the name of the application. Optionally can be followed by two arguments that are globs specifying input and output filehandles.

addhistory

$term->addhistory(line)

Adds line to the input history.

Features

$term->Features

Returns a reference to a hash whose keys are features present in the current implementation and whose values are assigned to each feature. Several optional features are used in the minimal interface:

appname
Should be present if the first argument to new is recognized

minline
Should be present if MinLine method is not a dummy

autohistory
Should be present if lines are put into history automatically (maybe subject to MinLine)

addhistory
Should be present if the addhistory method is not a dummy

findConsole

$term->findConsole

Returns array of two strings containing the most appropriate names for input and output files, using the conventions <$in and >$out.

MinLine

$term->MinLine([size])

With size argument, serves as a recommendation on minimal size of line to be added to history. Without an argument, does not add anything to the history. Returns the old value.

ReadLine

$term->ReadLine

Returns the actual package that executes the commands. Some possible values are Term::ReadLine::Gnu, Term::ReadLine::Perl, or Term::ReadLine::Stub.

readline

$term->readline(prompt)

Prompts for input line and gets the result. Removes trailing newline and returns undef at end-of-file.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.