I tend not to put any HTML into the plugin code, but instead send it to the plugin from the document level.
<ul>
<some_list_creating_plugin>
<li><some_marker></li>
</some_list_creating_plugin>
</ul>
some_list_creating_plugin => sub {
my @list = ['foo','bar','baz'];
my $mask = $_[0];
my $result;
foreach my $item (@list)
{
my $maskCopy = $mask;
$maskCopy =~ s@<some_marker>@$item@gs;
push (@results, $maskCopy);
}
return join (@results);
}
output
------
<ul>
<li>foo</li>
<li>bar</li>
<li>baz</li>
</ul>