in reply to CGI::Carp sometimes fails

I've never even used this module without also enabling warnings, maybe you need to see them too:
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
Also consider rolling your own die handler at DOING MORE THAN PRINTING A MESSAGE IN THE EVENT OF PERL ERRORS