Tickit::Utils - utility functions for Tickit
Tickit::Utils
Tickit
This module provides a number of utility functions used across Tickit.
Given a string in $str and a Tickit::StringPos instance in $pos, updates the counters in $pos by counting the string, and returns the number of bytes consumed. If $limit is given, then it will count no further than any of the limits given.
$str
$pos
$limit
Similar to string_count but will not zero the counters before it begins. Counters in $pos will still be incremented. If $start is provided it gives the byte offset within $str to begin counting from. This is more efficient than applying substr on the input string to create the starting point.
string_count
$start
substr
Returns the number of screen columns consumed by the given (Unicode) string.
Given a list of increasing character positions, returns a list of column widths of those characters. In scalar context returns the first columns width.
Given a list of increasing column widths, returns a list of character positions at those widths. In scalar context returns the first character position.
Similar to substr, but counts start offset and length in screen columns instead of characters
Returns a list of three integers created by aligning the $value to a position within the $total according to $alignment. The sum of the three returned values will always add to total.
$value
$total
$alignment
If the value is not larger than the total then the returned allocation will be the entire value, and the remaining space will be divided between before and after according to the given fractional alignment, with more of the remainder being allocated to the $after position in proportion to the alignment.
$after
If the value is larger than the total, then the total is returned as the allocation and the before and after positions will both be given zero.
Returns the value of $val bounded by the given minimum and maximum. Either limit may be left undefined, causing no limit of that kind to be applied.
$val
Paul Evans <leonerd@leonerd.org.uk>
To install Tickit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit
CPAN shell
perl -MCPAN -e shell install Tickit
For more information on module installation, please visit the detailed CPAN module installation guide.