You will often find that you want to terminate a page before the
end. This doesn't necessarily indicate an error condition; it can be
just that you've done all you want to do. When you do this, it is good
to first clean up, otherwise you can get annoying warnings showing up
in your error logs.
I use the following framework.
/cleanup.html is Executed from
/base.html, and it is the last thing that is done. It calls the
cleanup() function in the
while (($name, $query) = each (%domain::query))
Now, whenever I want to exit prematurely, I use a call to
$subs->clean_exit() rather than just exit(). This makes sure that the
queries and database connections are shut down nicely.