From: ivan Date: Wed, 20 Feb 2002 10:39:53 +0000 (+0000) Subject: fixes eidiot under Mason, closes: Bug#344 X-Git-Tag: freeside_1_4_0pre11~25 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=b4d4e05b95414fc334bf80474a0c10f639ac4ba1;hp=436df4de2b0cd4442eaf37f880f0ae017debeaf5 fixes eidiot under Mason, closes: Bug#344 --- diff --git a/FS/FS/CGI.pm b/FS/FS/CGI.pm index ee59b259f..190c0aa37 100644 --- a/FS/FS/CGI.pm +++ b/FS/FS/CGI.pm @@ -131,6 +131,8 @@ Sends an HTML error message, then exits. sub eidiot { warn "eidiot depriciated"; + $HTML::Mason::Commands::r->send_http_header + if defined $HTML::Mason::Commands::r; idiot(@_); &myexit(); } @@ -145,11 +147,22 @@ If running under mod_perl, calles Apache::exit, otherwise, calls exit. sub myexit { if (exists $ENV{MOD_PERL}) { - $main::Response->End() - if defined $main::Response - && $main::Response->isa('Apache::ASP::Response'); - require Apache; - Apache::exit(); + + if ( defined $main::Response + && $main::Response->isa('Apache::ASP::Response') ) { #Apache::ASP + $main::Response->End(); + require Apache; + Apache::exit(); + } elsif ( defined $HTML::Mason::Commands::m ) { #Mason + #$HTML::Mason::Commands::m->flush_buffer(); + $HTML::Mason::Commands::m->abort(); + die "shouldn't fall through to here (mason \$m->abort didn't)"; + } else { + #??? well, it is $ENV{MOD_PERL} + warn "running under unknown mod_perl environment; trying Apache::exit()"; + require Apache; + Apache::exit(); + } } else { exit; }