modperl_cgi_error_oput_debugging_issues

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Subject: Re: Producing an error page
From: George Sanderson <george@xorgate.com>
Date: Mon, 21 Aug 2000 21:48:01 -0500

Jay Strauss <jstrauss@compuserve.com> wrote:

>> 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.


At 12:04 PM 8/21/00 -0700, you wrote:
>The stuff that the server sends back comes from STDOUT if CGIs or within 
>mod-perl, either $req->print or a regular print since it is tied.  The 
>error messages go to STDERR which apache redirects internalls so that the 
>messages go to the error log.  I don't know that it's possible and I'm 
>certain it's not a good idea to try and circumvent that and send STDERR to 
>the browser.  And besides that, you'd still have to send content-type 
>headers.  I suppose you could write one perl program that executes your 
>perl program of interest from within an eval block and capture the output 
>that way.  But isn't simply looking at the error log easier?

At first, when I read the first message, I said to myself; (self) Why would
anyone want an error page with all the Perl HTML STDOUT/STDOUT stuff mixed
up together?  However, after reading and thinking some more, . . . (just
from a conceptional point of view and not from an implementation view
point), , , what a powerful concept!  If you (a developer) could regain the
Perl command line style of output from the web server (itself) without
having to piece together the STDOUT/STDERR during a debugging effort.  Now,
lets say that you had an Apache module that output a web page that looked
just like the stuff you could see from  the browsers "View/(Page)Source"
with the STDERR output included.  All one would have to do, is configure
the DEBUG handler in the httpd.conf, which would in turn produce what
appeared as HTML code with STDOUT included all within a HTML page.  The
STDERR output would be distinguished, with lets say:
 <<<STDERR>>> Opps got an error here or something. <<<\STDERR>>>
I'm sure you would also want a submit (DEBUG) button which could generate
the above, on-demand for form pages and such. (Kind of a DEBUG on demand
option.)

Is this what is being discussed here?  
(This is probably, not a mod_perl topic, but then again, it could be:-).


===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu