# obfu'd code, with some addntl comments # NB: there are many many of these my $it = Zmain::Foo->search( client => $client, status => 'active' ); while ( my $Foo = $it->next ) { # NB this is a master table of Things. A Foo is a specific kind of Thing. The master Thing table keeps ids and common info straight. my $thing = Zmain::Thing->retrieve($Foo->Foo); # NB not sure if this assert wastes time stringifying thing for the failure message if the assertion passes? assert( $thing, "found thing=" . $thing->thing ); my $info = $Foo->Bar->info; my $computed = $tm->compute( $info, $thing ); $tt->process( 'template.tt', { Foo => $Foo, computed => $computed }, # just handle one at a time sub { print $fh shift } ); }