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 (the Curses::UI instance). 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 a Curses::Window descendant will be removed. πŸ’€
  • accessor ( NAME, [VALUE] ) β€” if VALUE is 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 by HASHREF will be converted to lower case. Slay, lowercase era. πŸ”₯

πŸ“ Text processing πŸ“

  • split_to_lines ( TEXT ) β€” splits TEXT into a list of separate lines. It returns a reference to this list. 🧚
  • scrlength ( LINE ) β€” returns the screenlength of the string LINE. The difference with the perl function length() 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 the TEXT. 🌸
  • text_wrap ( LINE, LENGTH, WORDWRAP ) β€” wraps a line of text (LINE) to a given length (LENGTH). If the WORDWRAP argument is true, wordwrap will be enabled β€” and yes, this is the default for WORDWRAP. 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 ( ) and NO_WORDWRAP ( ) β€” these routines will return the correct value for the WORDWRAP argument. 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 the Curses module, 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 -1 if 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