The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

 Indent::Word - Class for word indenting.

SYNOPSIS

 use Indent::Word;
 my $indent = Indent::Word->new(%parameters);
 $indent->indent('text text text');

METHODS

new(%parameters)
 Constructor.
  • ansi

     Use with ANSI sequences.
     Default value is 0.
  • 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($data, [$indent, $non_indent])
 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.

ERRORS

 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

EXAMPLE1

 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

EXAMPLE2

 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

DEPENDENCIES

Class::Utils, English, Error::Pure, Indent::Utils, Readonly.

Text::ANSI::Util for situation with 'ansi' => 1.

SEE ALSO

Indent

Class for indent handling.

Indent::Block

Class for block indenting.

Indent::Data

Class for data indenting.

Indent::String

Class for text indenting.

Indent::Utils

Utilities for Indent classes.

Text::Wrap

line wrapping to form simple paragraphs

REPOSITORY

https://github.com/tupinek/Indent

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

 © 2005-2018 Michal Josef Špaček
 BSD 2-Clause License

VERSION

0.05