NAME

Indent::Block - Class for block indenting.

SYNOPSIS

use Indent::Block;

my $obj = Indent::Block->new(%parameters);
my $string = $obj->indent($data, [$act_indent, $non_indent]);
my @data = $obj->indent($data, [$act_indent, $non_indent]);

METHODS

new

my $obj = Indent::Block->new(%parameters);

Constructor.

Returns instance of object.

  • line_size

    Sets indent line size value.
    Default value is 'line_size' => 79.
  • next_indent

    Sets next indent string.
    Default value is 'next_indent' => "\t" (tabelator).
  • output_separator

    Sets output separator between indented datas for string context.
    Default value is 'output_separator' => "\n" (new line).
  • strict

    Sets or unsets strict mode.
    Unset strict mode means whitespace optimalization.
    Default value is 'strict' => 1.

indent

my $string = $obj->indent($data, [$act_indent, $non_indent]);

or

my @data = $obj->indent($data, [$act_indent, $non_indent]);

Indent method.

- C<$data_ar> - Reference to array with strings to indent.
- C<$act_indent> - String to actual indent.
- C<$non_indent> - Flag, that says 'no-indent' for current time.

Returns string to print or array of data to print.

ERRORS

new():
        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

EXAMPLE

 use strict;
 use warnings;

 use Indent::Block;

 # Object.
 my $i = Indent::Block->new(
         'line_size' => 2,
	 'next_indent' => '',
 );

 # Print in scalar context.
 print $i->indent(['text', 'text', 'text'])."\n";

 # Output:
 # text
 # text
 # text

DEPENDENCIES

Class::Utils, Indent::Utils, Readonly.

SEE ALSO

Indent

Class for indent handling.

Indent::Data

Class for data 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

http://skim.cz

LICENSE AND COPYRIGHT

© 2005-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.09