Tickit...e::Tab(3pm)

πŸ“¦
version 0.12 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Tickit::Console::Tab β€” the manual page, but make it cute ✨

okay bestie, so this is Tickit::Console::Tab from the User Contributed Perl Documentation family, and she is the tab class. Let's get into it 🫢


πŸŽ€ NAME πŸŽ€

"Tickit::Console::Tab" β€” represent a single tab on a "Tickit::Console"


🌸 DESCRIPTION 🌸

okay so picture this: objects in this class are one single switchable tab inside a Tickit::Console. That's the whole vibe. One tab. Switchable. Iconic.

and here's the tea β€” you do not construct them yourself, bestie, no cap. They get returned to you by the add_tab method of the underlying "Tickit::Console" object. She comes to you, you don't go to her πŸ’…


✨ PARAMETERS ✨

these extra parameters can be passed to the constructor, or handed over via the add_tab method on the "Tickit::Console" object:

  • timestamp_format => STRING or String::Tagged β€” if it's defined, every line gets prefixed with a timestamp, built by applying the POSIX::strftime function to this string. and if you hand her a String::Tagged instance? she preserves all the formatting from it. obsessed fr fr πŸ¦‹
  • datestamp_format => STRING or String::Tagged β€” if defined, then every time a line is added to the buffer, if it starts a new day since the previous message (because the format yields a different string), this message gets added to the scroller as well. new day, new stamp, she's keeping track 🌈
  • localtime => CODE β€” if defined, gives you an alternative function to "CORE::localtime" for converting an epoch value into a timestamp. for example, you could set it to
sub { gmtime $_[0] }

to generate timestamps in UTC instead of using the local timezone. timezone freedom, periodt ⭐


πŸ‘‘ METHODS πŸ‘‘

🧚 name

🧚 set_name

$name = $tab->name;

$tab->set_name( $name );

returns or sets the tab name text. short, sweet, does exactly what it says on the tin πŸŽ€

πŸ’œ append_line

$tab->append_line( $string, %opts );

appends a line of text to the tab. $string may either be a plain perl string, or an instance of String::Tagged containing formatting tags, as specified by Tickit::Widget::Scroller. options get passed along to the Tickit::Widget::Scroller::Item::Line that's used to contain the string.

she also recognises these extra options, bestie:

  • time => NUM β€” overrides the epoch time() value used to generate a timestamp for this line
  • timestamp_format => STRING or String::Tagged β€” overrides the stored format for generating a timestamp string
  • datestamp_format => STRING or String::Tagged β€” overrides the stored format for generating a datestamp string

πŸ¦‹ prepend_line

$tab->prepend_line( $string, %opts );

same as append_line, but she prepends it at the beginning of the scroller instead. front of the line energy, main character placement πŸ’…

πŸ”₯ bind_key

$tab->bind_key( $key, $code );

installs a callback to invoke if the given key is pressed while this tab has focus β€” and it overwrites any previous callback for the same key, so heads up. the code block gets invoked like this:

$result = $code->( $tab, $key );

if $code is missing or undef, any existing callback is removed. bye bestie πŸ‘‹

okay important detail: this callback gets invoked before one defined on the console object itself, if there is one. and if it returns a false value, then the one on the console gets invoked instead. so she's first in line, but she'll pass the mic if she has to 🎀

🌟 AUTHOR 🌟

Paul Evans <leonerd@leonerd.org.uk> β€” thank you king πŸ‘‘


and that's the whole page, bestie πŸ’– she's perl v5.36.0, dated 2024-01-01, and that's a wrap on Tickit...e::Tab(3pm) 🫢✨

πŸ“¦ where this page comes from