Note that the following happens outside the normal modperl build, I just
use Apache-Test framework, so it's possible that the problems happen,
becase something is not loaded outside of modperl setup.

If I write a simple handler like:

package Apache::Registry;
use Apache::compat ();
sub handler {
    $r = shift;
    #$r->send_http_header('text/plain');  # doesn't work!
    $r->log_error('TEST this');
    $r->print("Content-type: text/plain\r\n\r\n");
    $r->print("OK\n");
    0;#Apache::OK;
}

1;

and this config:

PerlModule Apache::Registry
<Location /cgi-test>
    PerlOptions +GlobalRequest
    SetHandler perl-script
    #SetHandler modperl
    Options +ExecCGI
    PerlResponseHandler "sub { delete $INC{'Apache/Registry.pm'}; require
Apache::Registry; Apache::Registry::handler(shift);}"
    PerlOptions +ParseHeaders
</Location>

$r->send_http_header sets the header, but doesn't send it, so I've to
manually print the header.

Now if I comment out:
        PerlOptions +ParseHeaders
or use
        SetHandler modperl
instead of
        SetHandler perl-script
$r->log_error doesn't work anymore:
[Tue Sep 11 18:45:38 2001] [error] [client 127.0.0.1] Undefined subroutine
&Apache::RequestRec::log_error called at
/home/stas/apache.org/registry/Apache-Registry/lib/Apache/Registry.pm line
8.

which for some reason gets cured with:
        use Apache::Log ();

And the final thing, I cannot get print() to work, only $r->print works. I
see that quite a few handlers in tests just print, but I cannot figure out
what's different in their code that makes plain print() work. I don't seem
to be able to override it :(

Uh, also what's the different between 'SetHandler perl-script' and
'SetHandler modperl'? I guess the former is for CGI scripts, but couldn't
find any docs.

Thanks.
_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to