in reply to Error reporting from web/mail scripts.
use CGI::Carp;
look up the docs shipping with your perl installation as CGI.pm is a standard module and comes along with CGI::Carp;
Have a nice day
All decision is left to your taste
Update
But you could also:
use CGI::Debug;