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

SYNOPSIS
     use Tags::HTML::Messages;

     my $obj = Tags::HTML::Messages-&gt;new(%params);
     $obj-&gt;process($message_ar);
     $obj-&gt;process_css($type, $color);

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

    Constructor.

    *       "css"

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

            Default value is undef.

    *       "css_messages"

            CSS class for main messages div block.

            Default value is 'messages'.

    *       "flag_no_messages"

            Flag for no messages printing.

            Possible values:

             0 - Print nothing
             1 - Print message box with 'No messages.' text.

            Default value is 1.

    *       "tags"

            'Tags::Output' object.

            Default value is undef.

  "process"
     $obj-&gt;process($message_ar);

    Process Tags structure for output.

    Reference to array with message objects $message_ar must be a instance
    of Data::Message::Simple object.

    Returns undef.

  "process_css"
     $obj-&gt;process_css($message_types_hr);

    Process CSS::Struct structure for output.

    Variable $message_type_hr is reference to hash with keys for message
    type and value for color in CSS style. Possible message types are info
    and error now. Types are defined in Data::Message::Simple.

    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():
             Bad list of messages.
             Bad message data object.

     process_css():
             Message types must be a hash reference.

EXAMPLE1
     use strict;
     use warnings;

     use CSS::Struct::Output::Indent;
     use Data::Message::Simple;
     use Tags::HTML::Page::Begin;
     use Tags::HTML::Page::End;
     use Tags::HTML::Messages;
     use Tags::Output::Indent;

     # Object.
     my $tags = Tags::Output::Indent-&gt;new(
             'preserved' =&gt; ['style'],
             'xml' =&gt; 1,
     );
     my $css = CSS::Struct::Output::Indent-&gt;new;
     my $begin = Tags::HTML::Page::Begin-&gt;new(
             'css' =&gt; $css,
             'lang' =&gt; {
                     'title' =&gt; 'Tags::HTML::Messages example',
             },
             'generator' =&gt; 'Tags::HTML::Messages',
             'tags' =&gt; $tags,
     );
     my $end = Tags::HTML::Page::End-&gt;new(
             'tags' =&gt; $tags,
     );
     my $messages = Tags::HTML::Messages-&gt;new(
             'css' =&gt; $css,
             'tags' =&gt; $tags,
     );

     # Error structure.
     my $message_ar = [
             Data::Message::Simple-&gt;new(
                     'text' =&gt; 'Error #1',
                     'type' =&gt; 'error',
             ),
             Data::Message::Simple-&gt;new(
                     'text' =&gt; 'Error #2',
                     'type' =&gt; 'error',
             ),
             Data::Message::Simple-&gt;new(
                     'lang' =&gt; 'en',
                     'text' =&gt; 'Ok #1',
             ),
             Data::Message::Simple-&gt;new(
                     'text' =&gt; 'Ok #2',
             ),
     ];

     # Process page.
     $messages-&gt;process_css({
             'error' =&gt; 'red',
             'info' =&gt; 'green',
     });
     $begin-&gt;process;
     $messages-&gt;process($message_ar);
     $end-&gt;process;

     # Print out.
     print $tags-&gt;flush;

     # Output:
     # &lt;!DOCTYPE html&gt;
     # &lt;html lang="en"&gt;
     #   &lt;head&gt;
     #     &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
     #     &lt;meta name="generator" content="Tags::HTML::Messages" /&gt;
     #     &lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;
     #     &lt;title&gt;
     #       Tags::HTML::Messages example
     #     &lt;/title&gt;
     #     &lt;style type="text/css"&gt;
     # .error {
     #         color: red;
     # }
     # .info {
     #         color: green;
     # }
     # &lt;/style&gt;
     #   &lt;/head&gt;
     #   &lt;body&gt;
     #     &lt;div class="messages"&gt;
     #       &lt;span class="error"&gt;
     #         Error #1
     #       &lt;/span&gt;
     #       &lt;br /&gt;
     #       &lt;span class="error"&gt;
     #         Error #2
     #       &lt;/span&gt;
     #       &lt;br /&gt;
     #       &lt;span class="info" lang="en"&gt;
     #         Ok #1
     #       &lt;/span&gt;
     #       &lt;br /&gt;
     #       &lt;span class="info"&gt;
     #         Ok #2
     #       &lt;/span&gt;
     #     &lt;/div&gt;
     #   &lt;/body&gt;
     # &lt;/html&gt;

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

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

AUTHOR
    Michal Josef Å&nbsp;paÄek &lt;mailto:skim@cpan.org&gt;

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

LICENSE AND COPYRIGHT
    Â© Michal Josef Å&nbsp;paÄek 2020-2025

    BSD 2-Clause License

VERSION
    0.10

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