in reply to stack dump quest

You could try using the confess method in Carp.

Also, CGI::Carp exists for use in CGI environments.