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

NAME

Term::CLI::ReadLine - maintain a single Term::ReadLine object

VERSION

version 0.04005

SYNOPSIS

 use Term::CLI::ReadLine;

 sub initialise {
    my $term = Term::CLI::ReadLine->new( ... );
    ... # Use Term::ReadLine methods on $term.
 }

 # The original $term reference is now out of scope, but
 # we can get a reference to it again:

 sub somewhere_else {
    my $term = Term::CLI::ReadLine->term;
    ... # Use Term::ReadLine methods on $term.
 }

DESCRIPTION

Even though Term::ReadLine(3p) has an object-oriented interface, the Term::ReadLine::Gnu(3p) library really only keeps a single instance around (if you create multiple Term::ReadLine objects, all parameters and history are shared).

This class inherits from Term::ReadLine and keeps a single instance around with a class accessor to access that single instance.

CONSTRUCTORS

new ( ... )

Create a new Term::CLI::ReadLine object and return a reference to it. Arguments are identical to Term::ReadLine(3p) and Term::ReadLine::Gnu(3p).

A reference to the newly created object is stored internally and can be retrieved later with the term class method. Note that repeated calls to new will reset this internal reference.

METHODS

See Term::ReadLine(3p) and Term::ReadLine::Gnu(3p) for the inherited methods.

term_width

Return the width of the terminal in characters, as given by Term::ReadLine.

term_height

Return the height of the terminal in characters, as given by Term::ReadLine.

CLASS METHODS

term

Return the latest Term::CLI::ReadLine object created.

SEE ALSO

Term::CLI(3p). Term::ReadLine(3p), Term::ReadLine::Gnu(3p).

AUTHOR

Steven Bakker <sbakker@cpan.org>, 2018.

COPYRIGHT AND LICENSE

Copyright (c) 2018 Steven Bakker

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See "perldoc perlartistic."

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.