Re: Encode parameters (feature request?)

"Dave W. Smith" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
Mathew Robertson writes:
> You could sub-class H::T then overload param() to do whatever you
> needed to do.
>
> Would this help?

Sometimes params are destined for an ESCAPE=HTML tag, and
sometimes they're headed for one that's ESCAPE=0, and param()
isn't in a position to know which. If you override param()
to use HTML::Entities::encode_entities(), you have to
stick with ESCAPE=0 in your templates, lest you get double
encoding of '&'.

We opted to patch HTML::Template to do the escaping for us.
I submitted a patch for this a while back (and a co-worker
submitted a corrected patch to fix the detail I missed).
The patch will be in the archives somewhere. We've been
using the patch in production for nearly a year, and are
happy with it.

An alternative would be to run the ->output() through
HTML::Entities::encode_entities() before printing (taking
care to not mangle HTML).

Dave




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.