++ed by:

1 non-PAUSE user.

Michal Josef Špaček

NAME

Indent - Class for indent handling.

SYNOPSIS

 use Indent;
 my $indent = Indent->new(%parameters);
 $indent->add([$cur_indent]);
 my $string = $indent->get;
 $indent->remove([$cur_indent]);
 $indent->reset([$reset_value]);

METHODS

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.
 Returns 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 ''.

ERRORS

 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'.

EXAMPLE

 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

DEPENDENCIES

Class::Utils, Error::Pure, Readonly.

SEE ALSO

Indent::Block

Class for block indenting.

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/tupinek/Indent

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

 © 2005-2018 Michal Josef Špaček
 BSD 2-Clause License

VERSION

0.05