[% # THis is in templatelib.tt %] [% MACRO date_template(parm1, parm2, parm3) BLOCK %] [% SWITCH parm1 %] [% CASE "value 1" %] display this way [% CASE "value 2" %] display other way [% CASE DEFAULT %] display default way [% END %] [% END %] #### [% # this is foo.tt %] [% PROCESS templatelib.tt %] [% date_template(parm_from_script, "foo", "bar") %] #### my $template = Template->new(); my $t_vars = { parm_from_script => "value 1", other_stuff => "mmmm donuts", }; $template->process("foo.tt", $t_vars) || die $template->error();