Re: [htmltmpl] New Template Object based on Existing one
Brought to you by:
samtregar
From: <sa...@es...> - 2004-02-08 18:13:21
|
Roger Burton West wrote: > On Sun, Feb 08, 2004 at 12:40:45PM -0500, Chris Faust wrote: >> Seriously, this may be a silly or even stupid question - but is there=20= >> some way to create a new template object and simply assign it all the=20= >> params as a existing template object? > > I haven't tried this, but my first reaction is to use the usual syntax > for interrogating a template: > > $content2->param($content->param); It's even simpler: simply associate the first object with the second. #!/usr/bin/perl use HTML::Template; my $tmpl =3D new HTML::Template filehandle =3D> \*DATA; $tmpl->param(foo =3D> "bar"); print $tmpl->output; my $str =3D "Second template: foo =3D <TMPL_VAR NAME=3Dfoo>\n"; my $copy =3D new HTML::Template scalarref =3D> \$str, associate =3D> = $tmpl; print $copy->output; __END__ First Template: foo =3D <TMPL_VAR NAME=3Dfoo> =3Dcut will print: $ perl associate.pl First Template: foo =3D bar Second template: foo =3D bar S=E9bastien Aperghis-Tramoni -- - --- -- - -- - --- -- - --- -- - --[ http://maddingue.org ] Close the world, txEn eht nepO= |