The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Term::ReadLine::Perl5::OO:History

DESCRIPTION

Variables and functions supporting Term::ReadLine::Perl5's and Term::ReadLine::Perl5::OO's command history.

SUBROUTINES

add_line_to_history

#add_line_to_history($line, $minlength)

Insert $line into history list if $line is:

  • bigger than the minimal length $minlength

  • not same as last entry

add_history

#add_history($line1, ...)

Place lines in array @_ at the end of the history list unless the history is stifled, or there are already too many items.

read_history

#read_history($filename)

Add the contents of $filename to the history list, a line at a time. If filename is undef, then read from `~/.history'. Returns 0 if successful, or $! if not.

remove_history

#remove_history(unused, $which)

Remove history element $which from the history. The removed element is returned.

GetHistory

GetHistory

returns the history of input as a list.

SetHistory

#SetHistory($line1 [, $line2, ...])

Sets the history of input, from where it can be used.

history_is_stifled

history_is_stifled

Returns true if saved history has a limited (stifled) or false if there is no limit (unstifled).

unstifle_history

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.

replace_history_entry

#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.

clear_history

#clear_history()

Clear or reset readline history.

write_history #write_history($filename)

Write the current history to filename, overwriting filename if necessary. If filename is NULL, then write the history list to `~/.history'. Returns 0 on success, or errno on a read or write error.

read_history() and write_history() follow GNU Readline's C convention of returning 0 for success and 1 for failure.

ReadHistory

#ReadHistory([$filename [,$from [,$to]]])

        $i = ReadHistory('~/.history')

Adds the contents of $filename to the history list, a line at a time. If $<filename> is false, then read from ~/.history. Start reading at line $from and end at $to. If $from is omitted or zero, start at the beginning. If $to is omitted or less than $from, then read until the end of the file. Returns true if successful, or false if not.

Note: the return code is the negation of read_history. Otherwise, it's the same.

WriteHistory

#WriteHistory([$filename])

        $i = WriteHistory('~/.history')

Writes the current history to $filename, overwriting $filename if necessary. If $filename is false, then write the history list to ~/.history. Returns true if successful, or false if not. Note: the return code is the negation of write_history. Otherwise, it's the same.

AUTHOR

Rocky Bernstein

SEE ALSO

Term::ReadLine::Perl5