Hi,
On Thu, 23 Aug 2001, John wrote:
> The current incarnation of my script blows itself out of the water if the
> $user_body variable (the TEXTAREA source) is greater than 4K, for example.
> This is good.
>
> I would like to be able to capture and control the process so that I don't
> get rudely blown out of the water with a crude 500 Server message (this
> would be gooder! <g>). I would like to: a)generate a useful message and, b)
> set some flags, do some more processing, and send a message back to the user
> to give them an opportunity to correct their input and atone for their sins.
> (This would be more gooder! <g>)
In general, you always want to die gracefully from within a web script so
the error is logged and the user doesn't get an icky 500 error page.
For example, in database apps I write, for any error, I tell the user the
database is unavailable and I log the error.
The following has worked for me when dealing with POST_MAX:
use CGI qw/:standard/;
$CGI::POST_MAX=1024 * 10;
$CGI::DISABLE_UPLOADS = 1;
$| = 1;
my $page = new CGI;
print $page->header;
$run = $page->param('RUN');
if (!$run && cgi_error()) {
# do whatever you do for an error
&dieWell ("413: Max Posting surpassed.");
}
sub dieWell {
my $message = shift;
# remember to print proper headers if not done by now
print "$thanks_for_playing_message\n";
# do logging of $message if you want, send yourself email, whatever
&footer; # end my html -
exit;
}
Lisa Wolfisch Nyman <[EMAIL PROTECTED]> IT Warrior Princess
"Life is too short to wear ugly underwear."
Get the facts at http://quickfacts.census.gov/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]