in reply to What is dienice???
This is one of those moments where I wish I had one of those amnesia flash things from Men In Black. A quick survey via google has led me to believe that every example of code that uses the literal dienice subroutine out there is unadulterated crap, having been cut and pasted from some ancestral piece of mid 90's perl 4 code and hacked without any great understanding until it does what the person wanted. You probably do not want to be using this code as an example of good Perl programming. Of course I am probably being entirely unfair to some very good examples of code but there you go.
In addition to the comments of tachyon and davorg, you might also want to look at the facilities offered by the module CGI::Carp which, through its fatalsToBrowser mode and the set_message subroutine allows you to catch to catch a die and then present your own message to the users browser, of course it is unwise to be showing the real error message to the whole world but it often makes debugging easier, so you can for instance check if the request is coming from your IP and if so show the whole error otherwise showing a bland message:
#!/usr/bin/perl + use strict; + use CGI::Carp qw(fatalsToBrowser set_message); + + my $sub_message = sub { my ($message) = @_; if ($ENV{REMOTE_ADDR} eq '127.0.0.1') { print "Oops: $message"; } else { print "Unable to process, please try later" +; } }; + set_message($sub_message); + die "aiee!";
/J\
|
|---|