PYX::SGML::Tags - Processing PYX data or file and write as SGML via Tags.
use PYX::SGML::Tags; my $obj = PYX::SGML::Tags->new(%parameters); $obj->parse($pyx, $out); $obj->parse_file($input_file, $out); $obj->parse_handler($input_file_handler, $out); $obj->finalize;
new
my $obj = PYX::SGML::Tags->new(%parameters);
Constructor.
input_encoding
Input encoding for parse_file() and parse_handler() usage.
Default value is 'utf-8'.
input_tags_item_callback
Input 'Tags' item callback. This callback is for Tags::Output::* constructor parameter 'input_tags_item_callback'.
Default value is undef.
output_encoding
Output encoding.
tags
Tags object. Can be any of Tags::Output::* objects. Default value is Tags::Output::Raw-new('output_handler' => \*STDOUT)>. It's required.
Tags::Output::Raw-
Returns instance of class.
parse
$obj->parse($pyx, $out);
Parse PYX text or array of PYX text. Output is serialization to SGML by Tags::Output::* module. If $out not present, use 'output_handler'.
$out
Returns undef.
parse_file
$obj->parse_file($input_file, $out);
Parse file with PYX data. $input_file file is decoded by 'input_encoding'. Output is serialization to SGML. If $out not present, use 'output_handler'.
$input_file
parse_handler
$obj->parse_handler($input_file_handler, $out);
Parse PYX handler. $input_file_handler handler is decoded by 'input_encoding'. Output is serialization to SGML. If $out not present, use 'output_handler'.
$input_file_handler
finalize
$obj->finalize; Finalize opened tags, if exists. Returns undef.
new(): Bad 'Tags::Output::*' object. From Class::Utils::set_params(): Unknown parameter '%s'. parse(): From PYX::Parser::parse(): Bad PYX line '%s'. From Tags::Output::Raw::flush(): Cannot write to output handler. parse_file(): From PYX::Parser::parse_file(): Bad PYX line '%s'. No input handler. From Tags::Output::Raw::flush(): Cannot write to output handler. parse_handler(): From PYX::Parser::parse_handler(): Bad PYX line '%s'. No input handler. From Tags::Output::Raw::flush(): Cannot write to output handler.
use strict; use warnings; use PYX::SGML::Tags; # Input. my $pyx = <<'END'; (element -data )element END # Object. my $obj = PYX::SGML::Tags->new; # Process. $obj->parse($pyx); print "\n"; # Output: # <element>data</element>
use strict; use warnings; use PYX::SGML::Tags; use Tags::Output::Indent; # Input. my $pyx = <<'END'; (element -data )element END # Object. my $obj = PYX::SGML::Tags->new( 'tags' => Tags::Output::Indent->new( 'output_handler' => \*STDOUT, ), ); # Process. $obj->parse($pyx); print "\n"; # Output: # <element>data</element>
use strict; use warnings; use PYX::SGML::Tags; use Tags::Output::Indent; # Input. my $pyx = <<'END'; (element -data )element END # Object. my $obj = PYX::SGML::Tags->new( 'input_tags_item_callback' => sub { my $tags_ar = shift; print '[ '.$tags_ar->[0].' ]'."\n"; return; }, ); # Process. $obj->parse($pyx); print "\n"; # Output: # [ b ] # [ d ] # [ e ] # <element>data</element>
Class::Utils, Error::Pure, PYX::Parser, PYX::Utils, Tags::Output::Raw.
Install the PYX modules.
https://github.com/michal-josef-spacek/PYX-SGML-Tags
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2011-2023 Michal Josef Špaček
BSD 2-Clause License
0.10
To install PYX::SGML::Tags, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PYX::SGML::Tags
CPAN shell
perl -MCPAN -e shell install PYX::SGML::Tags
For more information on module installation, please visit the detailed CPAN module installation guide.