The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tags::Element - Element utilities for 'Tags'.

SYNOPSIS

 use Tags::Element qw(element);

 my @tags = element($element, @data);

SUBROUTINES

element($element, @data)

 my @tags = element($element, @data);

Common element helper for writing Tags code.

Returns array of element in Tags format.

EXAMPLE1

 use strict;
 use warnings;

 use Data::Printer;
 use Tags::Element qw(element);

 # Get example element.
 my @tags = element('div', {
         'id' => 'foo',
         'class' => 'bar',
 }, 'Foo', 'Bar');

 # Dump to stdout.
 p @tags;

 # Output.
 # [
 #     [0] [
 #         [0] "b",
 #         [1] "div"
 #     ],
 #     [1] [
 #         [0] "a",
 #         [1] "class",
 #         [2] "bar"
 #     ],
 #     [2] [
 #         [0] "a",
 #         [1] "id",
 #         [2] "foo"
 #     ],
 #     [3] [
 #         [0] "d",
 #         [1] "Foo"
 #     ],
 #     [4] [
 #         [0] "d",
 #         [1] "Bar"
 #     ],
 #     [5] [
 #         [0] "e",
 #         [1] "div"
 #     ]
 # ]

EXAMPLE2

 use strict;
 use warnings;

 use Tags::Element qw(element);
 use Tags::Output::Raw;

 # Get example element.
 my @tags = element('div', {
         'id' => 'foo',
         'class' => 'bar',
 }, 'Foo', 'Bar');

 # Serialize by Tags.
 my $tags = Tags::Output::Raw->new;
 $tags->put(@tags);
 print $tags->flush."\n";

 # Output.
 # <div class="bar" id="foo">FooBar</div>

DEPENDENCIES

Exporter, Readonly.

SEE ALSO

Tags

Structure oriented SGML/XML/HTML/etc. elements manipulation.

Task::Tags

Install the Tags modules.

AUTHOR

Michal Josef Špaček skim@cpan.org

LICENSE AND COPYRIGHT

© 2011-2022 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.04