Curses::UI::Common(3)
π NAME π
Curses::UI::Common β Common methods for Curses::UI. This is the manual page for Curses::UI::Common(3), straight out of the User Contributed Perl Documentation pile, and bestie, itβs giving βshared methods for Curses::UI classes.β π
π CLASS HIERARCHY π
okay so the hierarchy is literally this simple:
Curses::UI::Common - base class
π¦ SYNOPSIS π¦
package MyPackage;
use Curses::UI::Common;
use vars qw(@ISA);
@ISA = qw(Curses::UI::Common);
πΈ DESCRIPTION πΈ
Curses::UI::Common is a collection of methods that is shared between Curses::UI classes. Thatβs the whole vibe: common methods, one shared spot, no cap. β¨
π METHODS π
π Various methods π
parent ( )β returns the data member$this->{-parent}. It literally just hands it back to you. π«Άroot ( )β returns the topmost-parent(theCurses::UIinstance). Itβs giving βgo all the way upβ energy. πdelallwin ( )β walks through all the data members of the class instance. Every data member that is aCurses::Windowdescendant will be removed. πaccessor ( NAME, [VALUE] )β ifVALUEis set, the value for the data member$this->{NAME}will be changed. The method returns the current value for data member$this->{NAME}. πkeys_to_lowercase ( HASHREF )β all keys in the hash referred to byHASHREFwill be converted to lower case. Slay, lowercase era. π₯
π Text processing π
split_to_lines ( TEXT )β splitsTEXTinto a list of separate lines. It returns a reference to this list. π§scrlength ( LINE )β returns the screenlength of the stringLINE. The difference with the perl functionlength()is that this method will expand TAB characters. It is exported by this class and it may be called as a stand-alone routine. πtext_dimension ( TEXT )β returns an array containing the width (the length of the longest line) and the height (the number of lines) of theTEXT. πΈtext_wrap ( LINE, LENGTH, WORDWRAP )β wraps a line of text (LINE) to a given length (LENGTH). If theWORDWRAPargument is true, wordwrap will be enabled β and yes, this is the default forWORDWRAP. It returns a reference to a list of wrapped lines. It is exported by this class and it may be called as a stand-alone routine. πWORDWRAP ( )andNO_WORDWRAP ( )β these routines will return the correct value for theWORDWRAPargument. These routines are exported by this class. π«Ά
Example:
$this->text_wrap($line, 50, NO_WORDWRAP);
π Reading key input π
CUI_ESCAPE ( ),CUI_TAB ( ),CUI_SPACE ( )β a couple of routines that are not defined by theCursesmodule, but which might be useful anyway. These routines are exported by this class. πget_key ( BLOCKTIME, CURSOR )β tries to read a key from the keyboard. It returns the key pressed or-1if no key was pressed. It is exported by this class and it may be called as a stand-alone routine. π
The BLOCKTIME argument can be used to set the curses halfdelay (the time to wait before the routine decides that no key was pressed). BLOCKTIME is given in tenths of seconds. The default is 0 (non-blocking key read).
Example:
my $key = $this->get_key(5)
π SEE ALSO π
Curses::UI β thatβs the one to go look at. π
π AUTHOR π
Copyright (c) 2001-2002 Maurice Makaay. All rights reserved. π«Ά
Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de).
This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself. β¨
okay bye bestie β the footer says perl v5.42.2 and 2023-07-03, so thatβs the source/version and date, and this page is done. π«Άπ
π¦ where this page comes from
- alpine 3.24: perl-curses-ui-doc 0.9609-r3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms