Hi Sam and all,
Seeing all the ideas about custom escape options, perhaps it's a good idea
to redesign HTML::Template a little bit so that it stores a hash of escaper
classname => object pairs. Each time a TMPL_VAR passes by with an escape
option, HTML::Template converts that option (safely) to a classname such as
HTML::Template::Escaper::XXXX. If HTML::Template hasn't already got an
instance of this escaper class in it's hash, then an attempt is done to
create an instance using require and store it in the hash. If the escaper
object is in the hash then an escape method is called in the object using
the data to be escaped as parameter.
This will make HTML::Template more flexible and everybody can write their
own escaper classes without deteriorating the performance or increasing
compile time and memory usage of HTML::Template for those who don't need
these escape options.
This style of design is something you see on CPAN in modules such as DBI,
Protect your PC - get McAfee.com VirusScan Online
From: Philip S Tellis <philip.tellis@gm...> - 2002-11-14 18:25:49
Sometime Today, Craig Manley assembled some asciibets to say:
> Seeing all the ideas about custom escape options, perhaps it's a
> good idea to redesign HTML::Template a little bit so that it stores
> a hash of escaper classname => object pairs. Each time a TMPL_VAR
> passes by with an escape option, HTML::Template converts that option
> (safely) to a classname such as HTML::Template::Escaper::XXXX. If
I think something like this was dicussed quite some time ago... about
having all escape=foo call a subroutine &escape_foo, or something like
that. I don't quite remember the exact details. Maybe someone else can
fill it in.
I've never been canoeing before, but I imagine there must be just a few
simple heuristics you have to remember...
Yes, don't fall out, and don't hit rocks.
Get latest updates about Open Source Projects, Conferences and News.