I'm writing a custom error-handling module for a steaming pile of CGIs that should rollback any active database handles, disconnect 'em, and choke out a nice, friendly message before dying. I'd like to be able to take advantage of HTML::Template with a default error template if possible, but to just spit out an HTML page if HTML::Template hasn't been loaded by the script that calls my module. Does anyone know of a reliable way to determine (from within the module) if the calling script has loaded another module? Is this the kind of thing for which I should just use eval()?
I'm also currently passing any active database handles manually into the module's functions. Is there a smart way to get a list of all active handles, so I don't have to trust myself to pass them to the error function?