NAME

Tags::HTML::Element::Utils - Tags::HTML::Element utilities.

SYNOPSIS

use Tags::HTML::Element::Utils qw(tags_boolean tags_data tags_label tags_value);

tags_boolean($self, $element, $method);
tags_data($self, $object);
tags_label($self, $object);
tags_value($self, $element, $method, $method_rewrite);

DESCRIPTION

Utilities for Tags::HTML::Element classes.

SUBROUTINES

tags_boolean

tags_boolean($self, $element, $method);

Get Tags structure for element attribute, which is boolean if $method exists.

Returns array of Tags structure.

tags_data

tags_data($self, $object);

Get or process $object->data defined by $object->data_type method.

Possible data_type values are:

plain

Convert plain text data in $object->data to Tags data structure and put to $self->{'tags'} method.

tags

Put Tags data structure in $object->data and put to $self->{'tags'} method.

cb

Call $object->data callback.

tags_label

tags_label($self, $object);

Process Tags structure for element label, which is before form item element.

Returns undef.

tags_value

tags_value($self, $element, $method, $method_rewrite);

Get Tags structure for element attribute, which is value if $method exists. $method_rewrite is value for key of attribute, when it's different than $method name.

Returns array of Tags structure.

EXAMPLE1

use strict;
use warnings;

use Data::Printer;
use Tags::HTML::Element::Utils qw(tags_boolean);
use Test::MockObject;

my $self = {};
my $obj = Test::MockObject->new;
$obj->set_true('foo');

# Process $obj->foo.
my @tags = tags_boolean($self, $obj, 'foo');

# Print out.
p $tags[0];

# Output (like attribute <element foo="foo">):
# [
#     [0] "a",
#     [1] "foo",
#     [2] "foo"
# ]

DEPENDENCIES

Exporter, Readonly.

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