Indent::Data - Class for data indenting.
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]);
new
my $obj = Indent::Data->new(%parameters);
Constructor.
Returns instance of object.
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
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.
$act_indent
$non_indent
Returns string or array of data to print.
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
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|
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|
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|
Class::Utils, Error::Pure, Indent::Utils, Readonly.
Class for indent handling.
Class for block indenting.
Class for text indenting.
Utilities for Indent classes.
Class for word indenting.
https://github.com/michal-josef-spacek/Indent
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2005-2021 Michal Josef Špaček
BSD 2-Clause License
0.08
To install Indent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Indent
CPAN shell
perl -MCPAN -e shell install Indent
For more information on module installation, please visit the detailed CPAN module installation guide.