CGI::Carp fatalsToBrowser does not work all the time as you have discovered. You will be dieing in the open and CGI::Carp does not catch this. Uncomment the typo and it will catch that, but not the die. It is a bug in CGI::Carp which is why I don't bother to use it. See CGI Help Guide for all sorts of tips (including a way to get almost all your errors onto the screen). Anyway this mod will tell you that the path does not exist or you don't have the required perms and you are dieing on the open.....
#!/usr/bin/perl -w
use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
print "Content-type: text/html\n\n";
my $time = time;
my $timepage = "/path/data/back_up/edit/$time.txt";
#typo
open FH, "> $timepage" or die_nice( "Can't open $timepage: $!" );
close FH;
print "$timepage";
sub die_nice {
my ( $err ) = @_;
print "Content-Type: text/html\n\n$err\n";
warn "ERR - $err\n";
exit 1;
}
I recommend using a die_nice routine in all CGI rather than a naked die. Note I always print a header in this so you won't 500. Also note that I get the header out ASAP so you won't 500. The only really good reason not to put the header out in the first few lines is that you may want to send a cookie or image or other header later.
The other possibilities include no Perl, CGI or CGI::Carp are not installed (so you have compile errors) or no execute perms ie you forgot to chmod 755 your script. But it smells like permissions or path.
PS When this sort of thing occurs the quickest way to the answer is to distill ie try:
#!/usr/bin/perl
print "Content-Type: text/html\n\nWe have ignition!"
#!/usr/bin/perl
use CGI ':standard';
print header(), 'Engage CGI';
#!/usr/bin/perl
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);
print header(), 'Enterprise You are clear to go with Carp';
print "Roger Houston testing Carp with typo now
etc
|