package MyApp; use MyFramework; sub call { my $self = shift; my $dbh = DBI->connect('dbi:mysql:myapp_db'); my $hello = $dbh->selectall_arrayref('SELECT * FROM my_table')->[0][0]; my $template = Template->new(INCLUDE_PATH => 'root/template'); $template->process('hello.tt', { hello => $hello }, \(my $output)); return $output; }