NAME

Tags::HTML::Element::Option - Tags helper for HTML option element.

SYNOPSIS

use Tags::HTML::Element::Option;

my $obj = Tags::HTML::Element::Option->new(%params);
$obj->cleanup;
$obj->init($option);
$obj->prepare;
$obj->process;
$obj->process_css;

METHODS

new

my $obj = Tags::HTML::Element::Option->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;

Process cleanup after page run.

In this case cleanup internal representation of button set by init.

Returns undef.

init

$obj->init($option);

Process initialization in page run.

Accepted $option is Data::HTML::Element::Option.

Returns undef.

prepare

$obj->prepare;

Process initialization before page run.

Do nothing in this object.

Returns undef.

process

$obj->process;

Process Tags structure for HTML option element to output.

Do nothing in case without inicialization by init.

Returns undef.

process_css

$obj->process_css;

Process CSS::Struct structure for HTML option element to output.

Do nothing in case without inicialization by init.

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():
        Option object must be a 'Data::HTML::Element::Option' 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::Option;
use Tags::HTML::Element::Option;
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::Option->new(
        'css' => $css,
        'tags' => $tags,
);

# Data object for option.
my $option = Data::HTML::Element::Option->new(
        'css_class' => 'form-option',
        'data' => ['Option'],
);

# Initialize.
$obj->init($option);

# Process option.
$obj->process;
$obj->process_css;

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

# Output:
# HTML:
# <option class="form-option">
#   Option
# </option>
#
# CSS:
# TODO

DEPENDENCIES

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

REPOSITORY

https://github.com/michal-josef-spacek/Tags-HTML-Element

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2022-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.15