Indent - Class for indent handling.
use Indent; my $indent = Indent->new(%parameters); $indent->add([$cur_indent]); $indent->get; $indent->remove([$cur_indent]); $indent->reset([$reset_value]);
new($option => $value)
This is a class method, the constructor for Indent. Options are passed as keyword value pairs. Recognized options are:
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([$cur_indent])
Method for adding $cur_indent, if defined, or 'next_indent'.
get()
Get actual indent string.
remove([$cur_indent])
Method for removing $cur_indent, if defined, or 'next_indent'. Only if is removable.
reset([$reset_value])
Resets internal indent string to $reset_value or ''.
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'.
# Pragmas. use strict; use warnings; # Modules. 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.
Indent::Block, Indent::Data, Indent::String, Indent::Utils, Indent::Word.
https://github.com/tupinek/Indent
Michal Špaček mailto:skim@cpan.org
http://skim.cz
BSD licence.
0.01
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.