On Fri, 11 Feb 2005, Scottsweep wrote:

>    I want to propose the following PATCH to
> HTML::Template. This would allow objects to be
> associated without the need to define a param method
> (all public methods can be TMPL_VARs). 

This seems like a reasonable thing to want, but I think it would be
better done with a wrapper object.  Imagine:

  use HTML::Template;
  use Class::ParamWrapper;

  my $t = HTML::Template->new(filename  => $foo,
                              associate => 
Class::ParamWrapper->new($some_object));

Class::ParamWrapper would provide a param() method which proxies calls
to the wrapped object.  You can add any configuration you need to the
Class::ParamWrapper->new() call.

This has the benefit of not increasing the complexity of
HTML::Template's associate implementation which is already pretty
unmanageable.  It also opens up your code to use in other contexts.

-sam

PS: If you want to submit a patch in the future please prepare it
using 'diff -u'.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to