Tickit...ringPos(3pm)
okay bestie, you're looking at the Tickit...ringPos(3pm) page from User Contributed Perl Documentation β and it's giving βone tiny object, four counters, zero chaos.β We're obsessed. π
β¨ NAME β¨
Tickit::StringPos β store string position counters. π
πΈ SYNOPSIS πΈ
use Tickit::StringPos;
use Tickit::Utils qw( string_count );
my $pos = Tickit::StringPos->zero;
string_count( "Here is a message", $pos );
print "The message consumes ", $pos->columns, " columns\n";
No cap, that's the whole vibe check. π
π¦ DESCRIPTION π¦
Instances in this object class store four position counters that relate to counting strings. Four little counters, one iconic little object. β¨
The bytes member counts UTF-8 bytes which encode individual codepoints. For example, the Unicode character U+00E9 is encoded by two bytes 0xc3, 0xa9; it would increment the bytes counter by 2 and the codepoints counter by 1. π
The codepoints member counts individual Unicode codepoints.
The graphemes member counts whole composed graphical clusters of codepoints, where combining accents which count as individual codepoints do not count as separate graphemes. For example, the codepoint sequence U+0065 U+0301 would increment the codepoint counter by 2 and the graphemes counter by 1. π§
The columns member counts the number of screen columns consumed by the graphemes. Most graphemes consume only 1 column, but some are defined in Unicode to consume 2. π
Instances are also used to store count limits, where any member may be set to -1 to indicate no limit in that counter. Lowkey important. β
π CONSTRUCTORS π
zero
$pos = Tickit::StringPos->zero
Returns a new instance with all counters set to zero. Fresh-start energy. β¨
limit_bytes, limit_codepoints, limit_graphemes, limit_columns
$pos = Tickit::StringPos->limit_bytes( $bytes )
$pos = Tickit::StringPos->limit_codepoints( $codepoints )
$pos = Tickit::StringPos->limit_graphemes( $graphemes )
$pos = Tickit::StringPos->limit_columns( $columns )
Return a new instance with one counter set to the given limit and the other three counters set to -1. Slay. π
π METHODS π
bytes, codepoints, graphemes, columns
$bytes = $pos->bytes
$codepoints = $pos->codepoints
$graphemes = $pos->graphemes
$columns = $pos->columns
These return the current value of each counter. Literally just hand you the numbers. π
π«Ά AUTHOR π«Ά
Paul Evans <leonerd@leonerd.org.uk> β iconic. π
This page is from perl v5.42.3, dated 2026-08-19, and it's the Tickit...ringPos(3pm) manual page. Periodt. π«Ά
π¦ where this page comes from
- ubuntu stonking: libtickit-perl 0.73-1build5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms