I'm having problems trying to get a mod_perl handler (a modified version of Lincoln Stein's Apache::NavBar) to filter the output of a CGI script (setup via Apache::OutputChain).

I've narrowed down the problem to something this simple:

Here's the CGI script:

#!/usr/local/bin/perl use strict; use CGI qw/:standard/; print header(); print start_html(); print "hello world\n"; print end_html;
Here's the relevant part of my httpd.conf:
<Location /perl> SetHandler perl-script PerlHandler Apache::OutputChain Apache::NavBar Apache::Registry Options +ExecCGI </Location>
And the snippet that is causing me the problem in Apache::NavBar:
sub handler { my $r = shift; warn "OK handler\n"; warn "CT: ", $r->content_type, "\n"; $r->content_type eq 'text/html' || return DECLINED; warn "OK text/html\n";

Whenever I invoke the CGI script, I get this in the output log: OK handler
CT:

That's right. The call to $r->content_type produces no output, even though it's set by default in the CGI script. I've tried forcing the issue:

print header(-type=>"text/html");
I even tried using bare print statements in case CGI.pm was doing something strange but I keep getting the same results. My guts tell me that I'm either missing something very fundamental in my understanding of the API or that something fishy is happening in mod_perl/Apache::Registry/Apache:OutputChain.

Some more information:
Red Hat 6.2 with all updates applied. If y'all want/need specific versions I can dig them up.

Thanks for your help,
Colin Kuskie


In reply to text/html !text/html?? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.