>I find that this breaks under some versions of Mod_Perl 2.0. I’m >working with two older versions: 1.99_07-dev and 1.99_12 both on Linux >machines.
You should really try to use at least RC 5+

My confusion is how to send the proper 2.0 header. In my in-house version Apache->request; does not seem to work. The 2.0 documentation says use Apache2::RequestUtil but that does not work either. My clients version however works with Apache->request and I’m confused as to why.
Apache2::RequestUtil doesn't exist in the versions you mentioned. Its still called Apache::RequestUtil.
http://perl.apache.org/docs/2.0/rename.html

To answer your question though, I believe you could do something like this, *untested*

unless ($ENV{GATEWAY_INTERFACE} =~ /Perl/) {
  ## CGI script or commandline

  if ($ENV{GATEWAY_INTERFACE} =~ /CGI/) {
    ## CGI
  }
  else {
    ## Commandline
  }
}
elsif ($ENV{MOD_PERL_API_VERSION} == 2) {
  ## mod_perl 2 RC 5 +
}
elsif (eval { require mod_perl } && $mod_perl::VERSION > 1.99) {
  ## mod_perl 1.9900 -> 1.99022 which is RC4
}
elsif ( $mod_perl::VERSION < 1.99) {
  ## mod_perl 1.x
}
else {
  ## fatal error .. I don't think this will get hit
}

Also, to send content headers in at least mp2, you should be using

i.e.
$r->content_header('text/html');


END
------------------------------------------------------------
    What doesn't kill us can only make us stronger.
                Nothing is impossible.
                                
Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
       http://www.liquidation.com
       http://www.uksurplus.com
       http://www.govliquidation.com
       http://www.gowholesale.com

Reply via email to