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

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/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.04