Tags::HTML::Container - Tags helper for container.
use Tags::HTML::Container; my $obj = Tags::HTML::Container->new(%params); $obj->process($tags_cb); $obj->process_css;
new
my $obj = Tags::HTML::Container->new(%params);
Constructor.
css
'CSS::Struct::Output' object for process_css processing.
Default value is undef.
css_container
CSS class for container box.
Default value is 'container'.
css_inner
CSS class for inner box in container.
Default value is 'inner'.
height
Container height in CSS style.
Default value is '100vh'.
horiz_align
Horizontal align.
Possible values are: center left right
Default value is 'center'.
vert_align
Vertical align.
Possible values are: base bottom center fit top
tags
'Tags::Output' object.
process
$obj->process($tags_cb);
Process Tags structure for container with code defined in $tags_cb callback. This callback has one argument and this is $self of container object.
$tags_cb
$self
Returns undef.
process_css
$obj->process_css;
Process CSS::Struct structure for output.
new(): From Class::Utils::set_params(): Unknown parameter '%s'. From Tags::HTML::new(): Parameter 'css' must be a 'CSS::Struct::Output::*' class. Parameter 'tags' must be a 'Tags::Output::*' class. Parameter 'horiz_align' is required. Parameter 'horiz_align' have a bad value. Value: %s Parameter 'vert_align' is required. Parameter 'vert_align' have a bad value. Value: %s process(): From Tags::HTML::process(): Parameter 'tags' isn't defined. There is no contained callback with Tags code. process_css(): From Tags::HTML::process_css(): Parameter 'css' isn't defined.
use strict; use warnings; use CSS::Struct::Output::Indent; use Tags::HTML::Container; use Tags::Output::Indent; # Object. my $css = CSS::Struct::Output::Indent->new; my $tags = Tags::Output::Indent->new; my $obj = Tags::HTML::Container->new( 'css' => $css, 'tags' => $tags, ); # Process container with text. $obj->process(sub { my $self = shift; $self->{'tags'}->put( ['d', 'Hello World!'], ); return; }); $obj->process_css; # Print out. print $tags->flush; print "\n\n"; print $css->flush; # Output: # <div class="container"> # <div class="inner"> # Hello World! # </div> # </div> # # .container { # display: flex; # align-items: center; # justify-content: center; # height: 100vh; # }
Class::Utils, Error::Pure, List::Util, Readonly, Tags::HTML,
https://github.com/michal-josef-spacek/Tags-HTML-Container
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2023 Michal Josef Špaček
BSD 2-Clause License
0.03
To install Tags::HTML::Container, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tags::HTML::Container
CPAN shell
perl -MCPAN -e shell install Tags::HTML::Container
For more information on module installation, please visit the detailed CPAN module installation guide.