Tags::Output::Structure - Structure class for 'Tags' output.
use Tags::Output::Structure; my $obj = Tags::Output::Structure->new(%parameters); $obj->finalize; my $ret_ar = $obj->flush($reset_flag); my @tags = $obj->open_tags; $obj->put(@data); $obj->reset;
new
my $obj = Tags::Output::Structure->new(%parameters);
Constructor.
Returns instance of object.
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_data
Skip bad tags. Default value is 0.
strict_instruction
Strict instruction. Default value is 1.
finalize
$obj->finalize;
Finalize Tags output. Automaticly puts end of all opened tags.
Returns undef.
flush
my $ret_ar = $obj->flush($reset_flag);
Flush tags in object. Or returns code. If enabled $reset_flag, then resets internal variables via reset method.
Returns undef or code.
open_tags
my @tags = $obj->open_tags;
Get list of opened tags.
Returns array of opened tags.
put
$obj->put(@data);
Put tags code in tags format.
reset
$obj->reset;
Resets internal variables.
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(): Ending bad tag: '%s' in block of tag '%s'.
use strict; use warnings; use Data::Printer; use Tags::Output::Structure; # Object. my $tags = Tags::Output::Structure->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. my $ret_ar = $tags->flush; # Dump out. p $ret_ar; # Output: # \ [ # [0] [ # [0] "b", # [1] "tag" # ], # [1] [ # [0] "a", # [1] "par", # [2] "val" # ], # [2] [ # [0] "c", # [1] "data", # [2] \ "data" # ], # [3] [ # [0] "e", # [1] "tag" # ], # [4] [ # [0] "i", # [1] "target", # [2] "data" # ], # [5] [ # [0] "b", # [1] "tag" # ], # [6] [ # [0] "d", # [1] "data", # [2] "data" # ], # [7] [ # [0] "e", # [1] "tag" # ] # ]
use strict; use warnings; use Tags::Output::Structure; # Object. my $tags = Tags::Output::Structure->new( 'output_handler' => \*STDOUT, ); # 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. $tags->flush; # Output: # ['b', 'tag'] # ['a', 'par', 'val'] # ['c', 'data', 'SCALAR(0x143d9c0)'] # ['e', 'tag'] # ['i', 'target', 'data'] # ['b', 'tag'] # ['d', 'data', 'data'] # ['e', 'tag']
Error::Pure, Tags::Output.
Structure oriented SGML/XML/HTML/etc. elements manipulation.
Base class for Tags::Output::*.
Install the Tags modules.
https://github.com/michal-josef-spacek/Tags-Output-Structure
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2012-2022 Michal Josef Špaček
BSD 2-Clause License
0.08
To install Tags::Output::Structure, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tags::Output::Structure
CPAN shell
perl -MCPAN -e shell install Tags::Output::Structure
For more information on module installation, please visit the detailed CPAN module installation guide.