Indent - Class for indent handling.
use Indent; my $indent = Indent->new(%parameters); $indent->add([$cur_indent]); my $string = $indent->get; $indent->remove([$cur_indent]); $indent->reset([$reset_value]);
new
my $indent = Indent->new(%parameters);
Constructor.
Returns instance of object.
indent
Default indent. Default value is ''.
next_indent
Next indent. Adding to internal indent variable after every add method calling. Default value is "\t" (tabelator).
add
$indent->add([$cur_indent]);
Method for adding $cur_indent, if defined, or 'next_indent'.
$cur_indent
Returns undef.
get
my $string = $indent->get;
Get actual indent string.
Returns string.
remove
$indent->remove([$cur_indent]);
Method for removing $cur_indent, if defined, or 'next_indent'. Only if is removable.
reset
$indent->reset([$reset_value]);
Resets internal indent string to $reset_value or ''.
$reset_value
new(): 'next_indent' parameter must be defined. 'next_indent' parameter must be a string. 'indent' parameter must be defined. 'indent' parameter must be a string. From Class::Utils::set_params(): Unknown parameter '%s'. remove(): Cannot remove indent '$indent'.
use strict; use warnings; use Indent; # Indent object. my $indent = Indent->new( # Begin indent. 'indent' => '->', # Next indent. 'next_indent' => "->" ); # Print example. print $indent->get; print "Example\n"; # Add indent and print ok. $indent->add; print $indent->get; print "Ok\n"; # Remove indent and print nex example. $indent->remove; print $indent->get; print "Example2\n"; # Reset. $indent->reset; # Output: # ->Example # ->->Ok # ->Example2
Class::Utils, Error::Pure, Readonly.
Class for block indenting.
Class for data 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.