Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

cog (4665)

Journal of cog (4665)

Thursday January 27, 2005
05:50 AM

Mason oddity, but not

[ #22907 ]
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... :-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Only perl can parse Perl. :-)
    • 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)?
      • 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>";.