# generate a new template handler my $th=Template::YetAnother->new ({ namespace=>'acme', template_dir=>'/projects/acme/templates/', }); # build up a data structure $data={ title=>$th->title('this is the title'), breadcrumb=>[ $th->link({url=>'/index.html',text=>'Home'}), $th->separator_breadcrumb, $th->link({url=>'/acme/index.html',text=>'Acme'}), $th->separator_breadcrumb, $th->link({url=>'/acme/bleach.html',text=>'Bleach'}), ], content=>[ $th->element({heading=>'SYNOPSIS',value=>'blabla'}), $th->element({heading=>'DESCRIPTION',value=>'foo bar'}), ], lastmod=>scalar localtime, }; # fill template & print print $th->fill({data=>$data}); ################################################## # for this to work, we need the following files in # /projects/acme/templates # file: main.tpl [% title %]
[% breadcrumb %]

[% title %]

[% content %]
[% lastmod %] # file: link.tpl [% text %] # file: seperator.tpl / # file: element.tpl

[% heading %]

;

[% value %]

; ################################################## # the finished template should look like this: this is the title
Home / Acme / Bleach

this is the title

SYNOPSIS

blabla

;

DESCRIPTION

foo bar


Thu Nov 7 21:51:05 200