----- Original Message -----
From: "Jon Brisbin" <brisbin@ipa.net>
To: "Embeded PERL ML" <embperl@perl.apache.org>
Sent: Tuesday, August 08, 2000 5:50 PM
Subject: Re: custom error handling in CGI mode
> > No, something like:
> >
> > my $rc = HTML::Embperl::Execute({inputfile => $ENV{PATH_TRANSLATED},
> > options =>
> > HTML::Embperl::optReturnError,
> > errors =>
> \@errors});
> >
>[..]
> but i put in an error in the page and it gives me a 500 error because it
> prints the error lines out before the html of my error document:
>
> bash-2.02$ ./epl
> (offline mode: enter name=value pairs on standard input)
> [21024]ERR: 46: Line 71: Unclosed command [$ if $] at end of file
>
If you don't send the http headers on your own, you have to include the
optSendHttpHeader options (runcgi normaly sets this option for you)
>Will I have to just put in an ErrorDocument 500 in my httpd.conf file??
You can use an ErrorDocument if it fit's your need, but when running in cgi
mode you don't have the error messages available there.
>
>
> Now I've tried this:
>
> use HTML::Embperl;
>
> $out = "";
> @errors = [];
> my $rc = HTML::Embperl::Execute({inputfile => $ENV{PATH_TRANSLATED},
> options => HTML::Embperl::optReturnError,
> errors => \@errors,
> output => \$out});
>
> if($rc ne 0) {
> HTML::Embperl::Execute({inputfile =>
> "/usr/www/jbrisbin/finder/htdocs/error.ehtml",
> param => \@errors,
> output => \$out});
> }
>
> print $out;
>
>
> which I don't like, because nothing gets sent to the browser until the
page
> is completely done...i'm also wondering if i'll ever get a situation where
> it'll print two headers, for example...??
>
> it does still send the email, though...that's good! :-)
>
yes
> Any other suggestions on making the output show up faster while the search
> is working??
>
You can set optEarlyHttpHeader, that will send the output imediately
(otherwise Embperl will buffer your output anyway), but in this case you
don't have the chance to send an error page when an error occurs inside the
page, because the headers and the start of the page are already send.
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW:
http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------