Thanks everybody, I've made it =))
<code>
package Die4CGI;
use strict;
$main::SIG{__DIE__} = \&Die4CGI::die;
sub die
{ my $dieMesg = shift; $dieMesg =~ s/ at .+$//;
my ($package, $file, $line) = caller;
$file =~ s/^C:\\Server\\Staff\\Connie\\Project\\onTry\\/\\/;
$file =~ s/\\/\//g;
print "Content-type: text/html\n\n";
print <<" HTML";
# A lot of html #
Garfield said: $dieMesg happens at: $file line $line.<br>
# A lot of html #
HTML
; exit(0);
}
1;
</code>
So I can call it like the normal :
use strict;
use Die4CGI;
my $file = 'somewhere/somewhere';
open FH, $file or die "$!"; # prints what I want
Another fatalsToBrowser, simple and lovely!! ;)
*BUT!! I still not understand, how can this overided
the orgional "die" ? Why shouldn't I write as :
open FH, $file or Die4CGI::die($!) ;
Would anybody tell me more ?
Rgds,
Connie
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]