NAME

UI::Various::PoorTerm::base - abstract helper class for PoorTerm's UI elements

SYNOPSIS

# This module should only be used by the UI::Various::PoorTerm UI
# element classes!

ABSTRACT

This module provides some helper functions for the UI elements of the minimal fallback UI.

DESCRIPTION

The documentation of this module is only intended for developers of the package itself.

All functions of the module will be included as second "base class" (in @ISA). Note that this is not a diamond pattern as this "base class" does not import anything besides Exporter.

METHODS

The module provides the following common (internal) methods for all UI::Various::PoorTerm UI element classes:

_wrap - wrap string according to width of UI element

$wrapped_string = $ui_element->_wrap($prefix, $string);

example:

print $self->_wrap($prefix, $self->text), "\n";

parameters:

$prefix             text in front of first line
$string             the string to be wrapped

description:

This method checks if the given prefix text and string fit within the maximum line length, and that the length of the string does not exceed the defined width for the UI element itself.

If string plus prefix is longer than the maximum line length, or if the string (without prefix!) is longer than the specific width for the UI element, the string gets automatically wrapped at the last word boundary before that length. Wrapped lines are prefixed with as much blanks as the prefix of the first line has characters.

Note that the specific width of the UI element is transitive meaning that it could be defined in one of the parents of the UI element itself.

Also note that if the method can't find a place to properly break up the string, it gives up and returns a longer one.

returns:

the (hopefully correctly) wrapped string

SEE ALSO

UI::Various

LICENSE

Copyright (C) Thomas Dorner.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See LICENSE file for more details.

AUTHOR

Thomas Dorner <dorner@cpan.org>