NAME
Indent::Data - Class for data indenting.
SYNOPSIS
use Indent::Data;
my $obj = Indent::Data->new(%parameters);
my $string = $obj->indent($data, [$indent, $non_indent]);
my @data = $obj->indent($data, [$indent, $non_indent]);
METHODS
new
my $obj = Indent::Data->new(%parameters);
Constructor.
Returns instance of object.
line_sizeSets indent line size value. Default value is 79.next_indentSets next indent string. Default value is tabelator (\t).output_separatorSets output separator between indented datas for string context. Default value is newline (\n).
indent
my $string = $obj->indent($data, [$indent, $non_indent]);
or
my @data = $obj->indent($data, [$indent, $non_indent]);
Indent text data to line_size block size. $act_indent - Actual indent string. Will be in each output string. Length of $act_indent variable must be less then ('line_size' - length of 'next_indent' - 1). $non_indent - Is flag for non indenting. Default is 0.
Returns string or array of data to print.
ERRORS
new():
        Bad 'line_size' = '%s' or length of string '%s'.
        Bad actual indent value. Length is greater then ('line_size' - 'size of next_indent' - 1).
        From Class::Utils::set_params():
                Unknown parameter '%s'.
indent():
        From Indent::Utils::line_size_check():
                'line_size' parameter must be a positive number.
                        line_size => %s
EXAMPLE1
use strict;
use warnings;
use Indent::Data;
# Indent::Data object.
my $i = Indent::Data->new(
       'line_size' => '10',
       'next_indent' => '  ',
       'output_separator' => "|\n",
);
# Print indented text.
print $i->indent('text text text text text text')."|\n";
# Output:
# text text |
#   text tex|
#   t text t|
#   ext|
EXAMPLE2
use strict;
use warnings;
use Indent::Data;
# Indent::Data object.
my $i = Indent::Data->new(
       'line_size' => '10',
       'next_indent' => '  ',
       'output_separator' => "|\n",
);
# Print indented text.
print $i->indent('text text text text text text', '<->')."|\n";
# Output:
# <->text te|
# <->  xt te|
# <->  xt te|
# <->  xt te|
# <->  xt te|
# <->  xt|
EXAMPLE3
use strict;
use warnings;
use Indent::Data;
# Indent::Data object.
my $i = Indent::Data->new(
       'line_size' => '10',
       'next_indent' => '  ',
       'output_separator' => "|\n",
);
# Print indented text.
print $i->indent('text text text text text text', '<->', 1)."|\n";
# Output:
# <->text text text text text text|
DEPENDENCIES
Class::Utils, Error::Pure, Indent::Utils, Readonly.
SEE ALSO
- Indent
 - 
Class for indent handling.
 - Indent::Block
 - 
Class for block indenting.
 - Indent::String
 - 
Class for text indenting.
 - Indent::Utils
 - 
Utilities for Indent classes.
 - Indent::Word
 - 
Class for word indenting.
 
REPOSITORY
https://github.com/michal-josef-spacek/Indent
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2005-2024 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.09