Re: Need help with a simple (I think) Perl script
- From: "szr" <szrRE@xxxxxxxxxxxxxxx>
- Date: Fri, 30 May 2008 16:48:16 -0700
comp.llang.perl.moderated wrote:
On May 30, 12:33 pm, "szr" <sz...@xxxxxxxxxxxxxxx> wrote:
xhos...@xxxxxxxxx wrote:
"szr" <sz...@xxxxxxxxxxxxxxx> wrote:
Ben Bullock wrote:
On Fri, 30 May 2008 01:16:39 +0200, Gunnar Hjalmarsson wrote:
If you develop a Perl program in a CGI
environment, you'd better make it a habit to
use CGI::Carp 'fatalsToBrowser';
It will make the browser display more meaningful error messages.
That may not always be a good habit, since the error messages are
meaningful only to the programmer:
http://schwern.org/~schwern/cgi-bin/unix2vms/
One can look for the messages produced by "die" in the error log
too, and if the code is in use by people other than the CGI
programmers (which it probably will be) it's probably a better bet
to not use the above outside of testing, since it will produce
something meaningless and confusing.
I wouldn't find it meaningless and confusing. It is quite clear
that an error has occurred, that is neither meaningless nor
confusing. It gives extra information, but I think I (being
hypothetically not a CGI programmer) would know enough to expect
that this is meaningful to someone else, if not to me, and that if
I wish to discuss the error with that someone else, it might be
helpful to quote parts of it to them, so in that way it is
meaningful as well as not confusing.
True (though I did not write what you were responding to.)
One trick I used in the past was to have a $SIG{__DIE__} handler
that check $ENV{REMOTE_ADDR} and if it was my own, print (custom)
errors ($! and such), else just dies, leaving the error in the
logs.
Unless by "just die" you mean use either the default CGI::Carp
thing or your own analog to it, by just dying you'd get an empty
page, or a partially rendered page, or a 500 error. I'd say that
*that* is meaningless and confusing!
I was talking about a generic case. I should of said a default error
page stating something weren't wrong, and a link allowing one to
report it. My point was this is one way one could have some simple
debugging when working on a live server (though I still recommend
using a separate dev environment.)
I've used a default page that exposes only a sanitized message and
then mails debug back to me.
Yes I've used such things and can be convenient. It all depends on what
you're doing, and in what sort of environment.
--
szr
.
- References:
- Need help with a simple (I think) Perl script
- From: *** Sutton
- Re: Need help with a simple (I think) Perl script
- From: A. Sinan Unur
- Re: Need help with a simple (I think) Perl script
- From: *** Sutton
- Re: Need help with a simple (I think) Perl script
- From: Lawrence Statton
- Re: Need help with a simple (I think) Perl script
- From: Ted Zlatanov
- Re: Need help with a simple (I think) Perl script
- From: A. Sinan Unur
- Re: Need help with a simple (I think) Perl script
- From: Ben Bullock
- Re: Need help with a simple (I think) Perl script
- From: Bill H
- Re: Need help with a simple (I think) Perl script
- From: Gunnar Hjalmarsson
- Re: Need help with a simple (I think) Perl script
- From: Ben Bullock
- Re: Need help with a simple (I think) Perl script
- From: szr
- Re: Need help with a simple (I think) Perl script
- From: xhoster
- Re: Need help with a simple (I think) Perl script
- From: szr
- Re: Need help with a simple (I think) Perl script
- From: comp.llang.perl.moderated
- Need help with a simple (I think) Perl script
- Prev by Date: Re: Need help with a simple (I think) Perl script
- Next by Date: Re: The Importance of Terminology's Quality
- Previous by thread: Re: Need help with a simple (I think) Perl script
- Next by thread: Re: Need help with a simple (I think) Perl script
- Index(es):