NAME

Tags::Output - Base class for Tags::Output::*.

SYNOPSIS

use Tags::Output;
my $obj = Tags::Output->new(%parameters);
$obj->finalize;
my $ret = $obj->flush($reset_flag);
my @tags = $obj->open_tags;
$obj->put(@data);
$obj->reset;

METHODS

new(%parameters)
  • auto_flush

    Auto flush flag.
    Default value is 0.
  • output_callback

    Output callback.
    Default value is undef.
  • output_handler

    Set output handler.
    Default value is undef.
  • output_sep

    Output separator.
    Default value is newline.
  • skip_bad_tags

    Skip bad tags.
    Default value is 0.
  • strict_instruction

    Strict instruction.
    Default value is 1.
finalize()
Finalize Tags output.
Automaticly puts end of all opened tags.
Returns undef.
flush($reset_flag)
Flush tags in object.
If defined 'output_handler' flush to its.
Or return code.
If enabled $reset_flag, then resets internal variables via reset method.
open_tags()
Return array of opened tags.
put(@data)
Put tags code in tags format.
Returns undef.
reset($reset_flag)
Resets internal variables.
Returns undef.

ERRORS

new():
        Auto-flush can't use without output handler.
        Output handler is bad file handler.
        From Class::Utils::set_params():
                Unknown parameter '%s'.

flush():
        Cannot write to output handler.

put():
        Bad data.
        Bad type of data.
        Bad number of arguments. 'Tags' structure %s

EXAMPLE

# Pragmas.
use strict;
use warnings;

# Modules.
use Tags::Output;

# Object.
my $tags = Tags::Output->new;

# Put all tag types.
$tags->put(
        ['b', 'tag'],
        ['a', 'par', 'val'],
        ['c', 'data', \'data'],
        ['e', 'tag'],
        ['i', 'target', 'data'],
        ['b', 'tag'],
        ['d', 'data', 'data'],
        ['e', 'tag'],
);

# Print out.
print $tags->flush."\n";

# Output:
# Begin of tag
# Attribute
# Comment
# End of tag
# Instruction
# Begin of tag
# Data
# End of tag

DEPENDENCIES

Class::Utils, Error::Pure.

SEE ALSO

Tags, Tags::Output::PYX, Tags::Output::Raw, Tags::Utils.

REPOSITORY

https://github.com/tupinek/Tags

AUTHOR

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

http://skim.cz

LICENSE AND COPYRIGHT

BSD license.

VERSION

0.01