[htmltmpl] Re: HTML::Template bug report: Problems using cache
Brought to you by:
samtregar
From: Sam T. <sa...@tr...> - 2005-11-30 00:01:17
|
On Tue, 29 Nov 2005, Jozef Kosoru wrote: > Since there wasn't any new release for more than one year I would also like > to ask you whether this package is still maintanted. It's still maintained, although I'm too busy to spend a lot of time on it right now. Maybe next year... > Regarding this bug. Could you help me somehow, please? I've tried to fix > it myself, but the code is a bit too complex. Thank you. Hmmm, alright, let's see. > my $rTmpl1 = HTML::Template->new(filename => $htmlTemplate, cache => 1); > my $rTmpl2 = HTML::Template->new(filename => $htmlTemplate, cache => 1); Ok, that won't work. The cache is going to hand you back two references to the same object. Try this instead: use Storable qw(dclone); my $rTmpl1 = HTML::Template->new(filename => $htmlTemplate, cache => 1); my $rTmpl2 = dclone($rTmpl2); Or, possibly faster: use Clone qw(clone); my $rTmpl1 = HTML::Template->new(filename => $htmlTemplate, cache => 1); my $rTmpl2 = clone($rTmpl2); -sam |