NAME

Term::CLI::Base - generic base class for Term::CLI classes

VERSION

version 0.060000

SYNOPSIS

package Term::CLI::Something {

   use Moo;

   extends 'Term::CLI::Base';

   ...
};

DESCRIPTION

Generic base class for Term::CLI(3p) classes. This class provides some basic functions and attributes that all classes except Term::CLI::ReadLine share.

METHODS

Accessors

error

Contains a diagnostic message in case of errors.

name

Element name. Can be any string, but must be specified at construction time.

term

The active Term::CLI::ReadLine object.

Others

clear_error

Set the error() attribute to the empty string and return 1.

parent

Return a reference to the object that "owns" this object. This is will be an instance of a class that inherits from Term::CLI::Element, or undef.

root_node

Walks the parent chain until it can go no further. Returns a reference to the object at the top. In a functional setup this is expected to be a Term::CLI(3p) object instance.

set_error ( STRING, ... )

Sets the error() attribute to the concatenation of all STRING parameters. If no arguments are given, or the first argument is undef, the error field is cleared (see set_error below).

Always returns a "failure" (undef or the empty list, depending on call context).

SEE ALSO

Term::CLI(3p), Term::CLI::Element(3p), Term::CLI::ReadLine(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.