Skip to content

michal-josef-spacek/SGML-PYX

Repository files navigation

NAME
    SGML::PYX - Convertor between SGML and PYX.

SYNOPSIS
     use SGML::PYX;

     my $obj = SGML::PYX->new(%params);
     $obj->parsefile($sgml_file);

METHODS
  "new"
     my $obj = SGML::PYX->new(%params);

    Constructor.

    Returns instance of object.

    *       "output"

             Output callback, which prints output PYX code.
             Default value is subroutine:
                     my (@data) = @_;
                     print join "\n", map { encode_utf8($_) } @data;
                     print "\n";
                     return;

  "parsefile"
     $obj->parsefile($sgml_file);

    Parse input SGML file and convert to PYX output.

    Returns undef.

ERRORS
     new():
             From Class::Utils::set_params():
                     Unknown parameter '%s'.

     parsefile():
             Unsupported tag type '%s'.
             Problem with attribute parsing.
                     data: %s

EXAMPLE
     use strict;
     use warnings;

     use File::Temp qw(tempfile);
     use IO::Barf qw(barf);
     use SGML::PYX;

     # Input file.
     my (undef, $input_file) = tempfile();
     my $input = <<'END';
     <html><head><title>Foo</title></head><body><div /></body></html>
     END
     barf($input_file, $input);

     # Object.
     my $obj = SGML::PYX->new;

     # Parse file.
     $obj->parsefile($input_file);

     # Output:
     # (html
     # (head
     # (title
     # -Foo
     # )title
     # )head
     # (body
     # (div
     # )div
     # )body
     # )html
     # -\n

DEPENDENCIES
    Class::Utils, Encode, Error::Pure, Tag::Reader::Perl, PYX, PYX::Utils.

SEE ALSO
    Task::PYX
        Install the PYX modules.

REPOSITORY
    <https://github.com/michal-josef-spacek/SGML-PYX>

AUTHOR
    Michal Josef Špaček <mailto:skim@cpan.org>

    <http://skim.cz>

LICENSE AND COPYRIGHT
    © Michal Josef Špaček 2015-2021

    BSD 2-Clause License

VERSION
    0.08