Term::CLI::ReadLine - maintain a single Term::ReadLine object
version 0.04002
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. }
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.
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.
new
See Term::ReadLine(3p) and Term::ReadLine::Gnu(3p) for the inherited methods.
Return the width of the terminal in characters, as given by Term::ReadLine.
Return the height of the terminal in characters, as given by Term::ReadLine.
Return the latest Term::CLI::ReadLine object created.
Term::CLI::ReadLine
Term::CLI(3p). Term::ReadLine(3p), Term::ReadLine::Gnu(3p).
Steven Bakker <sbakker@cpan.org>, 2018.
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.
To install Term::CLI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::CLI
CPAN shell
perl -MCPAN -e shell install Term::CLI
For more information on module installation, please visit the detailed CPAN module installation guide.