in reply to file input problem

if $q is the cgi object; you might try this (pseudo halfway code)
# try to open or die but not immediately open $file or go_away($file,$!); sub go_away { $file = shift; $error = shift; # tell the surfer something nice print $q->redirect($url_to_see_nicer_pages_than_500error); # now die and preserve my error log from being incomplete die(couldn't open $file: $error); }
so U don't loose the info to track on errors and can use your __DIE__ handler but fake a "nice world" to the surfer

Have a nice day
All decision is left to your taste