[Templates] Template::Plugin::Filter
Mark Fowler
Mark Fowler <mark@indicosoftware.com>
Fri, 15 Mar 2002 15:33:58 +0000 (GMT)
On Fri, 15 Mar 2002, Andy Wardley wrote:
> On Fri, Mar 15, 2002 at 12:15:09AM +0000, Mark Fowler wrote:
> > Template::Plugin::Filter - base class for easily adding
> > filters from Plugins
>
> It's a nice idea, but I'm guessing here that you haven't already come
> across the existing Template::Plugin::Filter module which does the same
> kind of thing. I added it to the core in 2.06b.
D'oh! I had no idea that this had happened. What's that they say about
great minds? ;-)
Can we add L<Template::Plugin::Filter> to the SEE ALSO of
Template::Filters please.
> Your module seems to be more feature-full than mine. Do you
> think you can merge your enhancements into the current module, or
> perhaps create a Template::Plugin::Filters (plural) or some other name?
Moving into the current module seems like a good idea.
I like the way that the current module lets you define a standard
subroutine. I'd like to merge the two modules so that by default the
filter exports anything you define as sub filter as the lowercase name
of the end of the plugin (as your code does) but also exports any
additional subroutine defined in @FILTERS, @FILTERS_DYNAMIC,
@FILTERS_STATIC.
The other change I'd like to make is to promote sub filter from a static
filter to the more complex semi-dynamic code that I have (meaning it will
be called with $text and then @args_of_filter_call as it's parameters.)
You can then override it with the $DYNAMIC or $STATIC tags I guess.
> Nice work, all the same.
;-)
Later.
Mark.
--
Mark Fowler
Technology Developer
http://www.indicosoftware.com/