Duh, I should have known that, been looking at this code to long.
Is there that much overhead in calling the new method on say 10 different
modules before processing the template, if the new methods are all just like
this?
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
return $self;
}
Or how about having one top level module that has an autoload function that
then determines what class/method is being called and dispatches it
accordingly? Would that be more or less efficient?
Chris
* Chris Ochs <chris at paymentonline.net> [2004/03/02 10:34]:
> We are using the template toolkit as a base for our own web application
> server. We have a number of custom functions/tags that are defined as
> template variables like so:
>
> $vars = {
> csm => MyPackage::Csm->new,
> }
>
> My question is, when is MyPackage::Csm->new actually called? Is it called
> only if a function in MyPackage::Csm is called via a tag such as [%
> csm.myfunction %] ? Or is MyPackage::Csm->new called every time a
template
> is processed regardless of whether any MyPackage::Csm functions are
called?
Since you're assigning the return of MyPackage::Csm->new to
$vars->{'csm'}, it happens before the template is processed.
(darren)
--
The test for truth is still quicker than the addition.
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates