Tags::HTML::Messages - Tags helper for HTML messages.
use Tags::HTML::Messages; my $obj = Tags::HTML::Messages->new(%params); $obj->process($message_ar, $id); $obj->process_css($id, $color);
new
my $obj = Tags::HTML::Messages->new(%params);
Constructor.
css
'CSS::Struct::Output' object for process_css processing.
It's required.
Default value is undef.
tags
'Tags::Output' object.
process
$obj->process($message_ar, $id);
Process Tags structure for output.
Returns undef.
process_css
$obj->process_css($id, $color);
Process CSS::Struct structure for output.
new(): Parameter 'css' must be a 'CSS::Struct::Output::*' class. Parameter 'tags' must be a 'Tags::Output::*' class. From Class::Utils::set_params(): Unknown parameter '%s'.
use strict; use warnings; use CSS::Struct::Output::Indent; use Tags::HTML::Page::Begin; use Tags::HTML::Page::End; use Tags::HTML::Messages; use Tags::Output::Indent; # Object. my $tags = Tags::Output::Indent->new( 'preserved' => ['style'], 'xml' => 1, ); my $css = CSS::Struct::Output::Indent->new; my $begin = Tags::HTML::Page::Begin->new( 'css' => $css, 'tags' => $tags, ); my $end = Tags::HTML::Page::End->new( 'tags' => $tags, ); my $messages = Tags::HTML::Messages->new( 'css' => $css, 'tags' => $tags, ); # Error structure. my $error_messages_ar = [ 'Error #1', 'Error #2', ]; my $ok_messages_ar = [ 'Ok #1', 'Ok #2', ]; # Process page. $messages->process_css('error', 'red'); $messages->process_css('ok', 'green'); $begin->process; $messages->process($error_messages_ar, 'error'); $messages->process($ok_messages_ar, 'ok'); $end->process; # Print out. print $tags->flush; # Output: # <!DOCTYPE html> # <html> # <head> # <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> # <title> # Page title # </title> # <style type="text/css"> # #error { # color: red; # } # #ok { # color: green; # } # </style> # </head> # <body> # <span id="error"> # Error #1 # </span> # <span id="error"> # Error #2 # </span> # <span id="ok"> # Ok #1 # </span> # <span id="ok"> # Ok #2 # </span> # </body> # </html>
Class::Utils, Error::Pure.
https://github.com/michal-josef-spacek/Tags-HTML-Messages
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© Michal Josef Špaček 2020
BSD 2-Clause License
0.01
To install Tags::HTML::Messages, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tags::HTML::Messages
CPAN shell
perl -MCPAN -e shell install Tags::HTML::Messages
For more information on module installation, please visit the detailed CPAN module installation guide.