Tags::Output::Indent - Indent class for Tags.
use Tags::Output::Indent(%params); my $tags = Tags::Output::Indent->new; $tags->put(['b', 'tag']); my @open_tags = $tags->open_tags; $tags->finalize; $tags->flush; $tags->reset;
new(%params)
Constructor
attr_callback
Subroutine for output processing of attribute key and value. Input argument is reference to array. Default value is &Tags::Utils::encode_attr_entities. Example is similar as 'data_callback'.
attr_delimeter
String, that defines attribute delimeter. Default is '"'. Possible is '"' or "'". Example: Prints <tag attr='val' /> instead default <tag attr="val" /> my $tags = Tags::Output::Indent->new( 'attr_delimeter' => "'", ); $tags->put( ['b', 'tag'], ['a', 'attr', 'val'], ['e', 'tag'], ); $tags->flush;
auto_flush
Auto flush flag. Default is 0.
cdata_indent
Flag, that means indent CDATA section. Default value is no-indent (0).
cdata_callback
Subroutine for output processing of cdata. Input argument is reference to array. Default value is undef. Example is similar as 'data_callback'.
data_callback
Subroutine for output processing of data. Input argument is reference to array. Default value is &Tags::Utils::encode_char_entities. Example: 'data_callback' => sub { my $data_ar = shift; foreach my $data (@{$data_ar}) { # Some process. $data =~ s/^\s*//ms; } return; }
line_size
TODO Default value is 79.
next_indent
TODO Default value is " ".
no_simple
Reference to array of tags, that can't by simple. Default is []. Example: That's normal in html pages, web browsers has problem with <script /> tag. Prints <script></script> instead <script />. my $tags = Tags::Output::Raw->new( 'no_simple' => ['script'] ); $tags->put( ['b', 'script'], ['e', 'script'], ); $tags->flush;
output_callback
Output callback. Input argument is reference to scalar of output string. Default value is undef. Example is similar as 'data_callback'.
output_handler
Handler for print output strings. Must be a GLOB. Default is undef.
output_separator
TODO Default value is newline (\n).
preserved
TODO Default value is reference to blank array.
raw_callback
Subroutine for output processing of raw data. Input argument is reference to array. Default value is undef. Example is similar as 'data_callback'.
skip_bad_tags
TODO Default value is 0.
strict_instruction
TODO Default value is 1.
finalize()
Finalize Tags output. Automaticly puts end of all opened tags.
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.
reset()
Resets internal variables.
'auto_flush' parameter can't use without 'output_handler' parameter. Bad attribute delimeter '%s'. Bad CDATA section. Bad data. Bad parameter '%s'. Bad tag type 'a'. Bad type of data. Ending bad tag: '%s' in block of tag '%s'. In XML mode must be a attribute value.
# Pragmas. use strict; use warnings; # Modules. use Tags::Output::Indent; # Object. my $tags = Tags::Output::Indent->new; # Put data. $tags->put( ['b', 'text'], ['d', 'data'], ['e', 'text'], ); # Print. print $tags->flush."\n"; # Output: # <text> # data # </text>
Error::Pure, Indent, Indent::Word, Indent::Block, List::MoreUtils, Readonly, Tags::Utils::Preserve.
Tags, Tags::Output, Tags::Output::ESIS, Tags::Output::Indent2, Tags::Output::LibXML, Tags::Output::PYX, Tags::Output::Raw, Tags::Output::SESIS, Tags::Utils.
Michal Špaček skim@cpan.org
BSD license.
0.02
To install Tags::Output::Indent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tags::Output::Indent
CPAN shell
perl -MCPAN -e shell install Tags::Output::Indent
For more information on module installation, please visit the detailed CPAN module installation guide.