Term::...::Base(3pm)
π Term::...::Base β the atomic routines page, bestie edition π
okay so you know Term::ReadLine::Zoid? This is the little base class underneath all of it β Term::ReadLine::Zoid::Base, from the User Contributed Perl Documentation, and it's literally just the atomic routines that every single Zoid object leans on. It's meant to be a base class, so don't go instantiating it like it's the main character. π«Ά
β¨ NAME β¨
Term::ReadLine::Zoid::Base β atomic routines. tiny building blocks, huge slay. π
πΈ DESCRIPTION πΈ
This module is where all the small atomic operations live, and every Term::ReadLine::Zoid object uses them. Think of it as a base class, not a finished product β it's giving scaffolding, not penthouse. π
At the very least, a child class needs two things to even function:
- a
default()function, so it can handle key bindings - a
draw()function, which in turn callsprint()
And also β this part is not optional, bestie β the attributes IN and OUT should contain valid filehandles. no filehandles, no vibes. π
π¦ METHODS π¦
π ANSI stuff
cursor_at($x, $y)β puts the cursor on the screen at that spot. heads up: the dimensions are 1-based, not 0-based, so don't come at it with programmer-brain. πclear_screen()β clears the screen. that's it. that's the whole method. iconic minimalism. β¨title($string)β sets the terminal title to$string. if you're using something likexterm(1), this is the window name you're setting. π·οΈprint_length($string)β returns the printable length of$string, and it does not count (some) ansi sequences. so escape codes don't inflate your count. lowkey the hero of the page. π
π Private api
These methods are for use in overload classes. Please avoid using them from the application. like, they're backstage. you do not have a backstage pass. π
bell()β notify the user of an error or limit. πloop()β a low level function used by readline. it callsdraw()anddo_key(). πbeat()β a method called by intervals while waiting for input, meant to be overloaded. πread_key()β returns one key read from input. and note bestie: this is the named key, not the char, when it's been mapped. β¨οΈdo_key($key)β execute a key; calls the subroutine for a key binding, or the default binding. if$keyis undefined,read_key()gets called first. π―press($string)β does the chars in$stringlike they were typed on the keyboard. used for testing puposes and to make macros possible.
if you give more then one argument, these are considered individual characters β use this to press named keys. π«°
unread_key($string)β unshifts characters on the read buffer. arguments are the same aspress(). βͺkey_name($chr)β returns a name for a character or character sequence. π·οΈkey_binding($key, $mode)β returns the keybinding for$keyin$mode.$modedefaults to the current one. πΊοΈbindchr($chr, $key)β bind a key name to a character, or a character sequence. all bindings of this kind are global β and honestly, (you're using only one keyboard, right ?) πrecalc_chr_map()β recalculates the chr map. you need to call this after deleting from%chr_names. don't skip it, fr fr. β»οΈprint($lines, $pos)β low level function used by draw. both arguments need to be array references. π
π BUGS π
Undefined behaviour when the buffer has more lines then the terminal. so likeβ¦ don't do that. π
Please mail the author if you find any other bugs. they want to know!! π«Ά
π AUTHOR π
Jaap Karmsenberg || Pardus [Larus] <pardus@cpan.org>
Copyright (c) 2004 Jaap G Karmsenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π SEE ALSO π
Term::ReadLine::Zoid
and that's the whole page, bestie β no cap, every flag, every method, every caveat, all accounted for. π
cute little sign-off: this page ships as part of perl v5.34.0, dated 2022-06-17. go forth and bind some keys. slay. π β¨
π¦ where this page comes from
- debian bookworm: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms