I may take a look at Dancer later, if time permits.
You call 30 lines of code long? I am used to real world applications that, taken together, involved as much as half a million lines of code. I guess that is a matter of perspective. In any event, the try/catch stuff can be easily deleted, but that leaves only an anchor to reinvoke the CGI script on the first access to it. Without some content on the page, you have no way to know, without accessing the server logs, whether or not the script worked. Further, the HTML generation is an essential part of using CGI to generate pages, and as I pointed out to the other fellow, I encountered problems with is_expired only in the context of the code actually running in a CGI script.