NAME
Text::UnicodeBox::Text - Objects to describe text rendering
DESCRIPTION
This module is part of the low level interface to Text::UnicodeBox; you probably don't need to use it directly.
METHODS
new (%params)
- value
-
The string representation of the text.
- length
-
How many characters wide the text represents when rendered on the screen.
EXPORTED METHODS
The following methods are exportable by name or by the tag ':all'
BOX_STRING ($value)
Given the passed text, figures out the a smart value for the length
field and returns a new instance.
align_and_pad
my $text = BOX_STRING('Test');
$text->align_and_pad(8);
# is the same as
# $text->align_and_pad( width => 8, pad => 1, pad_char => ' ', align => 'left' );
$text->value eq ' Test ';
Modify the value of this object to pad and align the text according to the specification. Pass any of the following parameters:
- width
-
Defaults to the object's
length
. Specifies how wide of a space the string is to be fit in. Doesn't make sense for this value to smaller then the width of the string. If you pass only one parameter toalign_and_pad
, this is the parameter it's assigned to. - align
-
If the string looks like a number, the align default to 'right'; otherwise, 'left'.
- pad (default: 1)
-
How much padding on the right and left
- pad_char (default: ' ')
-
What character to use for padding
to_string
Returns the value of this object.
COPYRIGHT
Copyright (c) 2012 Eric Waters and Shutterstock Images (http://shutterstock.com). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
AUTHOR
Eric Waters <ewaters@gmail.com>