.

ho hum... Sorry, ran out of steam
#### use HTML::Template; my $MAX_DEPTH = 3; my $t = HTML::Template->new( filename => "tmpl.tmpl", die_on_bad_params => 0, filter => mk_filter($MAX_DEPTH)); # populate with recursive data... $t->param( kids => recursive() ); print "Wheeee!"; print $t->output(); print ""; # # create a filter for HTML::Template # sub mk_filter { my $max = shift; my $cur = 0; return sub { print STDERR "FILTERING:\n",${$_[0]},"\n\n"; 1 while ${$_[0]} =~ s#(.*?)#do_filter($max,$cur++,$1,$2)#sgei ; print STDERR "FILTERED:\n",${$_[0]},"\n\n"; }; } # # Perform substitution # sub do_filter { my($max,$cur, $file, $els) = @_; if($cur < $max) { open my $f, $file or die $!; local $/ = undef; return <$f>; } else{ return $els; } } # # just produce some recursive data... # sub recursive { my $depth = shift || 0; my @kids = (); return [] if $depth > $MAX_DEPTH; push @kids, { name=> $_, depth=>$depth, kids=> recursive($depth+1) } foreach (0...2 ); return \@kids; }