> Didn't reusing mess the things under mod_perl...

No, I'm not sure where you got that from.

> and if not how can I reuse
> the template object, my situation is a little bit different i use object
to
> encapsulate Template and other stuff

Me too.  Most of the things you were setting in your call to Template->new()
can be set in $t->process() instead.  Some are trickier than others (like
changing the include path on each request), but recipes are in the mailing
list archives.

> package Blah;
> sub objMethod {
>    my $self = shift;
>    ...
>    $$self{tpl} = Template->new( ....);
> }
>
> So if I use something like this :
> package Blah;
> use vars qw($template);
>
> sub objMethod {
>    my $self = shift;
>    ...
>    $template ||= Template->new( ....);
>    $$self{tpl}= $template;
> }
>
> What will happen !?!

You'll reuse the same template object and have much better performance.  The
$template variable is now a static class variable.

> Or it can be also "our $template", aren't it ?

You kids have it so easy these days, with your newfangled Perl 5.6
keywords...

- Perrin



Reply via email to