On Mon, 19 Nov 2001 22:31:55 -0500 (EST)
Sam Tregar <[EMAIL PROTECTED]> wrote:
> > I would like to use it with HTML::Template::Expr, so if it is a
> > separate module that calls or inherits an HTML::Template object, I
> > would like the object it inherits to be configurable. How much am I
> > dreaming? A lot. But who knows, it might work.
>
> Maybe it could take an argument to new like "parent" that could be set to
> "HTML::Template::Expr" but would default to "HTML::Template". If you did
> that I would be willing to modify HTML::Template::Expr to do the same.
This is what sometimes bothers me;
* HTML::Template::Expr is great.
* HTML::Template::JIT might be great.
* HTML::Template::Component? Wow!
But what about mixing them?
IMO "Decorator Pattern" by GoF would be one of the solutions in
this case, like this:
use HTML::Template;
use HTML::Template::JIT;
use HTML::Template::Expr;
my $tmpl =
HTML::Template::Expr->new(
HTML::Template::JIT->new(
HTML::Template->new(
filename => 'foo.tmpl',
)
)
);
Looks quite ugly :), but then it's easy to wrap it up using
My::Template or so.
package My::Template;
use HTML::Template;
use HTML::Template::JIT;
use HTML::Template::Expr;
sub load {
return
HTML::Template::Expr->new(
HTML::Template::JIT->new(
HTML::Template->new(@_)
)
);
}
1;
package main;
my $template = My::Template->load(filename => 'foo.tmpl');
--
Tatsuhiko Miyagawa <[EMAIL PROTECTED]>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]