The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

HTML::Native::Comment - HTML::Native comment

SYNOPSIS

use HTML::Native::Comment;

my $comment = HTML::Native::Comment->new ( "This is a comment" );
print $comment;
# prints "<!-- This is a comment -->"

DESCRIPTION

An HTML::Native::Comment object represents an HTML comment. It can safely be included within an HTML::Native tree without being subject to entity encoding.

METHODS

new()

$comment = HTML::Native::Comment->new ( <text> );

Create a new HTML::Native::Comment object, representing a single HTML comment. For example:

my $comment = HTML::Native::Comment->new ( "This is a comment" );
print $comment;
# prints "<!-- This is a comment -->"

or

my $elem = HTML::Native->new (
  div =>
  [ h1 => "Welcome" ],
  "Hello world!",
  HTML::Native::Comment->new ( "Hide this" ),
);
print $elem;
# prints "<div><h1>Welcome</h1>Hello world!<!-- Hide this --></div>"