My first post to this list and it's question. Sorry. I'll try and
provide more meaningful content sometime in the future :)

Anyway, I've written this module 

http://thegestalt.org/simon/perl/Text-Chump.html

(available from http://thegestalt.org/simon/perl/Text-Chump-0.8.tar.gz)

and an accompanying TT filter

http://thegestalt.org/simon/perl/Template-Plugin-Chump.html

(http://thegestalt.org/simon/perl/Template-Plugin-Chump-0.8.tar.gz)

Which is all fine and dandy (especially once I'd found the
Template::Plugin::Filter base) except for the fact that I can't think of
a decent way to provide access to T:C's install() and new_type()
methods.


There are a few options I've thought of -

1. Allowing something like this


        [% USE Chump ($c) %]


where c is a Text::Chump object passed in via the params hash and which
has the handlers/new types installed already. This isn't ideal.

2. Installing a new scalar op or something from the plugin

        $Template::Stash::SCALAR_OPS->{'install_chump_handler'};

This is, I suspect, a bit naughty.


3. Passing the methods via the option hash


        [% USE Chump({ install_links => $sub, 
                       install_links_re=>'\d+'}) 
        %]


which is a bit crufty. Especially when it comes to installing new types


        [% FILTER chump ({ new_type_equal     => '=',
                           new_type_equal_sub => $sub,
                           new_type_equal_re  => 'ma+tch'}) 
        %]

but not entirely unworkable.


What I'd really like to do is something like

        [% USE Chump %]
        [% Chump.new_type('equal','=', $sub, 'ma+tch') %]
        [ var FILTER chump %]

Is that possible?


In anticipation,

Simon
*waves* shyly at the TT people

-- 
the test for truth is still quicker than addition


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to