Tickit::Console::Tab - represent a single tab on a Tickit::Console
Tickit::Console::Tab
Tickit::Console
Objects in this class represent a single switchable tab within a Tickit::Console. They are not constructed directly, but instead are returned by the add_tab method of the underlying Tickit::Console object.
add_tab
The following extra parameters may be passed to the constructor, or via the add_tab method on the Tickit::Console object:
If defined, every line is prefixed with a timestamp built by applying the POSIX::strftime function to this string. If a String::Tagged instance is applied it will preserve all the formatting from it.
POSIX::strftime
If defined, 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 is added as well to the scroller.
If defined, provides an alternative function to CORE::localtime for converting an epoch value into a timestamp. For example, this may be set to
CORE::localtime
sub { gmtime $_[0] }
to generate timestamps in UTC instead of using the local timezone.
$name = $tab->name $tab->set_name( $name )
Returns or sets the tab name text
$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 will be passed to the Tickit::Widget::Scroller::Item::Line used to contain the string.
$string
Also recognises the following options:
Overrides the epoch time() value used to generate a timestamp for this line
time()
Overrides the stored format for generating a timestamp string.
Overrides the stored format for generating a datestamp string.
$tab->prepend_line( $string, %opts )
As append_line, but prepends it at the beginning of the scroller.
append_line
$tab->bind_key( $key, $code )
Installs a callback to invoke if the given key is pressed while this tab has focus, overwriting any previous callback for the same key. The code block is invoked as
$result = $code->( $tab, $key )
If $code is missing or undef, any existing callback is removed.
$code
undef
This callback will be invoked before one defined on the console object itself, if present. If it returns a false value, then the one on the console will be invoked instead.
Paul Evans <leonerd@leonerd.org.uk>
To install Tickit::Console, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit::Console
CPAN shell
perl -MCPAN -e shell install Tickit::Console
For more information on module installation, please visit the detailed CPAN module installation guide.