NAME

Tags::HTML::Textarea - Tags helper for textareaelement.

SYNOPSIS

use Tags::HTML::Textarea;

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

METHODS

new

my $obj = Tags::HTML::Textarea->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($textarea);

Process Tags structure for fields defined in @fields to output.

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

Returns undef.

process_css

$obj->process_css($textarea);

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.

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

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

EXAMPLE

use strict;
use warnings;

use CSS::Struct::Output::Indent;
use Data::HTML::Textarea;
use Tags::HTML::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::Textarea->new(
        'css' => $css,
        'tags' => $tags,
);

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

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

# 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.

REPOSITORY

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

AUTHOR

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

http://skim.cz

LICENSE AND COPYRIGHT

© 2023 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.01