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->process($input);
$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.

process

$obj->process($option);

Process Tags structure for $option to output.

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

Returns undef.

process_css

$obj->process_css($option);

Process CSS::Struct structure for $option to output.

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

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.

process():
        From Tags::HTML::process():
                Parameter 'tags' isn't defined.
        Input object must be a 'Data::HTML::Element::Option' instance.

process_css():
        From Tags::HTML::process_css():
                Parameter 'css' isn't defined.
        Input object must be a 'Data::HTML::Element::Option' instance.

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',
);

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

# 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-2023 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.01