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 (\n).
  • 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.

METHODS TO OVERWRITE

new(%parameters)

Constructor.

_check_params()
Check parameters to rigth values.
Can check constructor parameters.
Returns undef.
_default_parameters()
Default parameters.
Set list of constructor parameters with default value.
e.g.:
$self->{'foo'} = 'bar';
Returns undef.
_put_attribute($attr, $value)
Attribute callback.
Method can write output to 'flush_code' object parameter as array or scalar.
Returns undef.
_put_begin_of_tag($tag)
Begin of tag.
Method can write output to 'flush_code' object parameter as array or scalar.
Returns undef.
_put_cdata(@cdata)
CData.
Method can write output to 'flush_code' object parameter as array or scalar.
Returns undef.
_put_comment(@comment)
Comment.
Method can write output to 'flush_code' object parameter as array or scalar.
Returns undef.
_put_data(@data)
Data.
Method can write output to 'flush_code' object parameter as array or scalar.
Returns undef.
_put_end_of_tag($tag)
End of tag.
Method can write output to 'flush_code' object parameter as array or scalar.
Returns undef.
_put_instruction($target, $code)
Instruction.
Method can write output to 'flush_code' object parameter as array or scalar.
Returns undef.
_put_raw(@raw_data)
Raw data.
Method can write output to 'flush_code' object parameter as array or scalar.
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

Task::Tags

Install the Tags modules.

REPOSITORY

https://github.com/tupinek/Tags

AUTHOR

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

http://skim.cz

LICENSE AND COPYRIGHT

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

VERSION

0.04