Indent::Word - Class for word indenting.
use Indent::Word; my $obj = Indent::Word->new(%parameters); my $string = $obj->indent('text text text'); my @data = $obj->indent('text text text');
new
my $obj = Indent::Word->new(%parameters);
Constructor.
Returns instance of object.
ansi
Use with ANSI sequences. Default value is: - 1 if COLOR env variable is set - 0 if NO_COLOR env variable is set - 0 otherwise
line_size
Sets indent line size value. Default value is 79.
next_indent
Sets output separator between indented datas for string context. Default value is "\t" (tabelator).
output_separator
Output separator between data in scalar context. Default value is "\n" (new line).
indent
my $string = $obj->indent('text text text');
or
my @data = $obj->indent('text text text');
Indent text by words to line_size block size.
$act_indent - Actual indent string. Will be in each output string. $non_indent - Is flag for non indenting. Default is 0.
Returns string or array with data to print.
Output is controlled by env variables NO_COLOR and COLOR. See https://no-color.org/.
NO_COLOR
COLOR
new(): Cannot load 'Text::ANSI::Util' module. From Class::Utils::set_params(): Unknown parameter '%s'. From Indent::Utils::line_size_check(): 'line_size' parameter must be a positive number. line_size => %s
use strict; use warnings; use Indent::Word; # Object. my $i = Indent::Word->new( 'line_size' => 20, ); # Indent. print $i->indent(join(' ', ('text') x 7))."\n"; # Output: # text text text text # <--tab->text text text
use strict; use warnings; use Indent::Word; use Term::ANSIColor; # Object. my $i = Indent::Word->new( 'ansi' => 1, 'line_size' => 20, ); # Indent. print $i->indent('text text '.color('cyan').'text'.color('reset'). ' text '.color('red').'text'.color('reset').' text text')."\n"; # Output: # text text text text # <--tab->text text text
Class::Utils, English, Error::Pure, Indent::Utils, Readonly.
Text::ANSI::Util for situation with 'ansi' => 1.
Class for indent handling.
Class for block indenting.
Class for data indenting.
Class for text indenting.
Utilities for Indent classes.
line wrapping to form simple paragraphs
https://github.com/michal-josef-spacek/Indent
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2005-2021 Michal Josef Špaček
BSD 2-Clause License
0.08
To install Indent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Indent
CPAN shell
perl -MCPAN -e shell install Indent
For more information on module installation, please visit the detailed CPAN module installation guide.