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 some way to create a new template object and simply assign it all the 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 = new HTML::Template filehandle => \*DATA;
$tmpl->param(foo => "bar");
print $tmpl->output;

my $str = "Second template: foo = <TMPL_VAR NAME=foo>\n";
my $copy = new HTML::Template scalarref => \$str, associate => $tmpl;
print $copy->output;

__END__
First Template: foo = <TMPL_VAR NAME=foo>
=cut

will print:

$ perl associate.pl
First Template: foo = bar
Second template: foo = bar


Sébastien Aperghis-Tramoni -- - --- -- - -- - --- -- - --- -- - --[ http://maddingue.org ] Close the world, txEn eht nepO


------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to