At first, I got a bit puzzled when this didn't work:
<%perl>
print "</%perl>";
</%perl>
It makes kind of sense. Thinking in HTML, we have:
<pre></pre></pre>
Which won't output the tag.
But still, it feels weird, because it's in the middle of a string which should be interpreted by perl... :-)
Re:The old adage...
cog on 2005-01-28T08:27:53
But would you consider that Mason should parse that the way I expected or the way it does (first tag closes and we get an error)?Re:The old adage...
Aristotle on 2005-01-28T16:48:08
I would expect Mason to parse it the way it does. To do it “correctly” it would have to parse the Perl code between the tags to find out whether the tag is a literal or embedded in a string or some suchlike, and attempt to do that would be foolproof. (Think, as a trivial example,
print q(</%perl>);
— and you can make up much hairier ones.)A simple workaround is
print "</"."%perl>";
.Re:The old adage...
cog on 2005-01-28T16:53:00
I guess you're right.A simple workaround is
print "</"."%perl>";
Actually,
"<\/%perl>"
does the trick just fine:-)