NAME

Tags::HTML::Element::Textarea - Tags helper for HTML textarea element.

SYNOPSIS

use Tags::HTML::Element::Textarea;

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

METHODS

new

my $obj = Tags::HTML::Element::Textarea->new(%params);

Constructor.

cleanup

$obj->cleanup;

Process cleanup after page run.

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

Returns undef.

init

$obj->init($textarea);

Process initialization in page run.

Accepted $textarea is Data::HTML::Element::Textarea.

Returns undef.

prepare

$obj->prepare;

Process initialization before page run.

Do nothing in this object.

Returns undef.

process

$obj->process;

Process Tags structure for output.

Do nothing in case without inicialization by init.

Returns undef.

process_css

$obj->process_css;

Process CSS::Struct structure for 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():
        Textarea object must be a 'Data::HTML::Element::Textarea' 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::Textarea;
use Tags::HTML::Element::Textarea;
use Tags::Output::Indent;

# Object.
my $css = CSS::Struct::Output::Indent->new;
my $tags = Tags::Output::Indent->new(
        'no_simple' => ['textarea'],
        'preserved' => ['textarea'],
        'xml' => 1,
);
my $obj = Tags::HTML::Element::Textarea->new(
        'css' => $css,
        'tags' => $tags,
);

# Data object for textarea.
my $textarea = Data::HTML::Element::Textarea->new(
        'cols' => 5,
        'css_class' => 'textarea',
        'id' => 'textarea',
        'rows' => 10,
);

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

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

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

# Output:
# HTML:
# <textarea class="textarea" id="textarea" cols="5" rows="10"></textarea>
#
# CSS:
# textarea.textarea {
#         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

http://skim.cz

LICENSE AND COPYRIGHT

© 2022-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.15