sub handle_error{ my $msg = shift ||' '; my $dbh = shift ||' '; my $sth = shift ||' '; #html::template - handle_error.tmpl my $tem = HTML::Template->new(filename => "handle_error.tmpl"); $tem -> param(message => $msg); print $tem->output; #finish the state handle and disconnect, if necessary $sth->finish() if $sth; $dbh->disconnect() if $dbh; exit 0; }