The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Indent::String - Class for text indenting.

SYNOPSIS

use Indent::String;

my $obj = Indent::String->new(%parameters);
my $string = $obj->indent('text text text');
my @data = $obj->indent('text text text');

METHODS

new

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

Constructor.

Returns instance of object.

  • 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

my $string = $obj->indent('text text text');

or

my @data = $obj->indent('text text text');

Indent text by words to line_size block size.

C<$act_indent> - Actual indent string. Will be in each output string.
C<$non_indent> - Is flag for non indenting. Default is 0.

Returns string 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::String;

# Object.
my $i = Indent::String->new(
        'line_size' => 20,
);

# Indent.
print $i->indent(join(' ', ('text') x 7))."\n";

# Output:
# text text text text
# <--tab->text text text

DEPENDENCIES

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

SEE ALSO

Indent

Class for indent handling.

Indent::Block

Class for block indenting.

Indent::Data

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