in reply to html/mason parser

Well, it's not exactly correct HTML, so your best bet would probably be, to strip out the <% %> tags beforehand.

something like

#!perl local $/; $_ = <STDIN>; s/<%.*?%>//sg; s/^%.*//g; # i think mason also interprets lines starting with % as p +erl code. print;
should do it.