Something that may be worthwhile as a starting point for you is CGI::Debug,
which basically does what you are asking I think. It leaves you with the
perl interpreter's error message (as if you had run the thing from a
command-line), a dump of relevant cookies, environment variables and CGI
parameters. I've found it very handy lately for debugging a largeish CGI
app. The only snag is that it doesn't (actually refuses explicitly) work
with mod_perl. Maybe ten minutes work for a mod_perl wizard? ;-)

Regards,

Howard.

> -----Original Message-----
> From: Jay Strauss [mailto:[EMAIL PROTECTED]]
> Sent: 21 August 2000 16:44
> To: [EMAIL PROTECTED]
> Subject: Re: Producing an error page
>
>
> Sorry,
>
> I didn't explain my question well.  But thanks for all the response.
>
> I left "my" out of my example on purpose, to illustrate a typical
> (in my case)
> programming error.
>
> To restate what I'm asking:
>
> Is there any way to redirect everything that would normally be sent to the
> screen, when I run from the command line, to an HTML page when I
> call my script
> from the browser (on a script by script basis).
>
> I've tried the suggestions so far:
>
> cgi::carp
> http://perl.apache.org/guide/snippets.html#Redirecting_Errors_to_t
> he_Client
> BEGIN { print "Content-Type: text/plain\n\n"; *STDERR = *STDOUT }
>
> None of these methods will print the diagnostic messages, and
> typically only
> print the line number at which I died.
>
> I'm not in a production environment, so I don't mind getting a
> bunch of ugly
> errors to my browser.
>
> Thanks again
> Jay
>
> Jay Strauss
> [EMAIL PROTECTED]
> (h) 773.935.5326
> (c) 312.617.0264
>
> ----- Original Message -----
> From: "Jay Strauss" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 21, 2000 8:56 AM
> Subject: Producing an error page
>
>
> >
> > Hi,
> >
> > I'm asking this again, due to lack of response (but I can't
> believe no one out
> > there knows how to do this).
> >
> > How do I produce an error page (in HTML), when I call the script from a
> browser,
> > that looks just like the error screen I get when I run a script
> at the command
> > line?
> >
> > That is, if I run the following script from the command line:
> >
> > -------
> > #!/usr/bin/perl -w
> >
> > use strict;
> > use diagnostics;
> >
> > ($first, $second) = @ARGV;
> >
> > exit;
> > -------
> >
> > I'll get a whole bunch of messages telling me I "use strict" and I have
> > variables that I didn't define with "my".
> >
> > But, if I call it from my browser, I just get back a "Internal
> Server Error"
> > page.  Instead I want all the diagnostics messages.
> >
> > Thanks
> > Jay
> >
> > Jay Strauss
> > [EMAIL PROTECTED]
> > (h) 773.935.5326
> > (c) 312.617.0264
> >
> >
>
>

Reply via email to