NAME
Indent::Data - Class for data indenting.
SYNOPSIS
use Indent::Data;
my $indent_data = Indent::Data->new(%parameters);
my @data = $indent_data->indent($data, [$indent, $non_indent]);
METHODS
new(%parameters)
-
Constructor.
line_size
Sets indent line size value. Default value is 79.
next_indent
Sets next indent string. Default value is tabelator (\t).
output_separator
Sets output separator between indented datas for string context. Default value is newline (\n).
indent($data, [$act_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.
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
# Pragmas.
use strict;
use warnings;
# Modules.
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
# Pragmas.
use strict;
use warnings;
# Modules.
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
# Pragmas.
use strict;
use warnings;
# Modules.
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, Indent::Block, Indent::Comment, Indent::Utils, Indent::Word.
REPOSITORY
https://github.com/tupinek/Indent
AUTHOR
Michal Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
BSD license.
VERSION
0.01