NAME
Tags::HTML::Element::Input - Tags helper for HTML input element.
SYNOPSIS
use Tags::HTML::Element::Input;
my $obj = Tags::HTML::Element::Input->new(%params);
$obj->cleanup;
$obj->init($input);
$obj->prepare;
$obj->process;
$obj->process_css;
METHODS
new
my $obj = Tags::HTML::Element::Input->new(%params);
Constructor.
css
'CSS::Struct::Output' object for process_css processing.
Default value is undef.
tags
'Tags::Output' object.
Default value is undef.
cleanup
$obj->cleanup;
Cleanup internal structures.
Returns undef.
init
$obj->init($input);
Initialize object.
Accepted $input
is Data::HTML::Element::Input.
Returns undef.
prepare
$obj->prepare;
Process initialization before page run.
Do nothing in this object.
Returns undef.
process
$obj->process;
Process Tags structure to output.
Returns undef.
process_css
$obj->process_css;
Process CSS::Struct structure for output.
Returns undef.
ERRORS
new():
From Tags::HTML::new():
Parameter 'css' must be a 'CSS::Struct::Output::*' class.
Parameter 'tags' must be a 'Tags::Output::*' class.
init():
Input object must be a 'Data::HTML::Element::Input' instance.
process():
From Tags::HTML::process():
Parameter 'tags' isn't defined.
process_css():
From Tags::HTML::process_css():
Parameter 'css' isn't defined.
EXAMPLE
use strict;
use warnings;
use CSS::Struct::Output::Indent;
use Data::HTML::Element::Input;
use Tags::HTML::Element::Input;
use Tags::Output::Indent;
# Object.
my $css = CSS::Struct::Output::Indent->new;
my $tags = Tags::Output::Indent->new(
'xml' => 1,
);
my $obj = Tags::HTML::Element::Input->new(
'css' => $css,
'tags' => $tags,
);
# Data object for input.
my $input = Data::HTML::Element::Input->new(
'css_class' => 'form-input',
);
# Initialize.
$obj->init($input);
# Process input.
$obj->process;
$obj->process_css;
# Print out.
print "HTML:\n";
print $tags->flush;
print "\n\n";
print "CSS:\n";
print $css->flush;
# Output:
# HTML:
# <input class="form-input" type="text" />
#
# CSS:
# input.form-input[type=submit]:hover {
# background-color: #45a049;
# }
# input.form-input[type=submit] {
# width: 100%;
# background-color: #4CAF50;
# color: white;
# padding: 14px 20px;
# margin: 8px 0;
# border: none;
# border-radius: 4px;
# cursor: pointer;
# }
# input.form-input {
# width: 100%;
# padding: 12px 20px;
# margin: 8px 0;
# display: inline-block;
# border: 1px solid #ccc;
# border-radius: 4px;
# box-sizing: border-box;
# }
DEPENDENCIES
Class::Utils, Error::Pure, Scalar::Util, Tags::HTML, Tags::HTML::Element::Utils.
REPOSITORY
https://github.com/michal-josef-spacek/Tags-HTML-Element
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2022-2024 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.15