<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Tags::HTML - Tags helper abstract class.

SYNOPSIS
     use Tags::HTML;

     my $obj = Tags::HTML-&gt;new(%params);
     $obj-&gt;cleanup(@params);
     $obj-&gt;prepare(@params);
     $obj-&gt;init(@params);
     $obj-&gt;process;
     $obj-&gt;process_css;

METHODS
  "new"
     my $obj = Tags::HTML-&gt;new(%params);

    Constructor.

    Returns instance of class.

    *       "css"

            'CSS::Struct::Output' object for "process_css" processing.

            Default value is undef.

    *       "no_css"

            No CSS support flag. If this flag is set to 1, "process_css"
            don't process CSS style.

            Default value is 0.

    *       "tags"

            'Tags::Output' object for "process" processing.

            Default value is undef.

  "cleanup"
     $obj-&gt;cleanup(@params);

    Process cleanup after page run.

    Returns undef.

  "init"
     $obj-&gt;init(@params);

    Process initialization in page run. It's useful in e.g.
    Plack::App::Tags::HTML.

    Returns undef.

  "prepare"
     $obj-&gt;prepare(@params);

    Process initialization before page run. It's useful in e.g.
    Plack::App::Tags::HTML.

    Returns undef.

  "process"
     $obj-&gt;process;

    Process Tags structure.

    Returns undef.

  "process_css"
     $obj-&gt;process_css;

    Process CSS::Struct structure.

    Returns undef.

ERRORS
     new():
             From Class::Utils::set_params():
                     Unknown parameter '%s'.
             Parameter 'css' must be a 'CSS::Struct::Output::*' class.
             Parameter 'tags' must be a 'Tags::Output::*' class.

     process():
             Need to be implemented in inherited class in _process() method.
             Parameter 'tags' isn't defined.

     process_css():
             Need to be implemented in inherited class in _process_css() method.
             Parameter 'css' isn't defined.

EXAMPLE1
     use strict;
     use warnings;

     package Foo;

     use base qw(Tags::HTML);

     sub new {
             my ($class, @params) = @_;
 
             # No CSS support.
             push @params, 'no_css', 1;
 
             my $self = $class-&gt;SUPER::new(@params);
 
             # Object.
             return $self;
     }

     sub _cleanup {
             my $self = shift;

             delete $self-&gt;{'_dynamic_data'};
             delete $self-&gt;{'_static_data'};

             return;
     }

     sub _init {
             my ($self, @variables) = @_;

             $self-&gt;{'_dynamic_data'} = \@variables;

             return;
     }

     sub _prepare {
             my ($self, @variables) = @_;

             $self-&gt;{'_static_data'} = \@variables;

             return;
     }

     sub _process {
             my $self = shift;

             $self-&gt;{'tags'}-&gt;put(
                     ['b', 'div'],
             );
             foreach my $variable (@{$self-&gt;{'_static_data'}}) {
                     $self-&gt;{'tags'}-&gt;put(
                             ['b', 'div'],
                             ['a', 'class', 'static'],
                             ['d', $variable],
                             ['e', 'div'],
                     );
             }
             foreach my $variable (@{$self-&gt;{'_dynamic_data'}}) {
                     $self-&gt;{'tags'}-&gt;put(
                             ['b', 'div'],
                             ['a', 'class', 'dynamic'],
                             ['d', $variable],
                             ['e', 'div'],
                     );
             }
             $self-&gt;{'tags'}-&gt;put(
                     ['e', 'div'],
             );

             return;
     }

     package main;

     use Tags::Output::Indent;

     # Object.
     my $tags = Tags::Output::Indent-&gt;new;
     my $obj = Foo-&gt;new(
             'tags' =&gt; $tags,
     );

     # Init static data.
     $obj-&gt;prepare('foo', 'bar');

     # Init dynamic data.
     $obj-&gt;init('baz', 'bax');

     # Process.
     $obj-&gt;process;

     # Print out.
     print "HTML\n";
     print $tags-&gt;flush."\n";

     # Output:
     # HTML
     # &lt;div&gt;
     #   &lt;div class="static"&gt;
     #     foo
     #   &lt;/div&gt;
     #   &lt;div class="static"&gt;
     #     bar
     #   &lt;/div&gt;
     #   &lt;div class="dynamic"&gt;
     #     baz
     #   &lt;/div&gt;
     #   &lt;div class="dynamic"&gt;
     #     bax
     #   &lt;/div&gt;
     # &lt;/div&gt;

EXAMPLE2
     use strict;
     use warnings;

     package Foo;

     use base qw(Tags::HTML);

     sub _process {
             my ($self, $value) = @_;

             $self-&gt;{'tags'}-&gt;put(
                     ['b', 'div'],
                     ['d', $value],
                     ['e', 'div'],
             );

             return;
     }

     sub _process_css {
             my ($self, $color) = @_;

             $self-&gt;{'css'}-&gt;put(
                     ['s', 'div'],
                     ['d', 'background-color', $color],
                     ['e'],
             );

             return;
     }

     package main;

     use CSS::Struct::Output::Indent;
     use Tags::Output::Indent;

     # Object.
     my $css = CSS::Struct::Output::Indent-&gt;new;
     my $tags = Tags::Output::Indent-&gt;new;
     my $obj = Foo-&gt;new(
             'css' =&gt; $css,
             'tags' =&gt; $tags,
     );

     # Process indicator.
     $obj-&gt;process_css('red');
     $obj-&gt;process('value');

     # Print out.
     print "CSS\n";
     print $css-&gt;flush."\n\n";
     print "HTML\n";
     print $tags-&gt;flush."\n";

     # Output:
     # CSS
     # div {
     #      background-color: red;
     # }
     #
     # HTML
     # &lt;div&gt;
     #   value
     # &lt;/div&gt;

DEPENDENCIES
    Class::Utils, Error::Pure, Scalar::Util.

SEE ALSO
    Plack::App::Tags::HTML
        Plack application for Tags::HTML objects.

    Plack::Component::Tags::HTML
        Plack component for Tags with HTML output.

REPOSITORY
    &lt;https://github.com/michal-josef-spacek/Tags-HTML&gt;

AUTHOR
    Michal Josef Е&nbsp;paДЌek &lt;mailto:skim@cpan.org&gt;

    &lt;http://skim.cz&gt;

LICENSE AND COPYRIGHT
    В© 2021-2023 Michal Josef Е&nbsp;paДЌek

    BSD 2-Clause License

VERSION
    0.08

</pre></body></html>