On Wed, May 05, 2004 at 04:13:23PM +0200, Peter Morling wrote:
>
> > I'm not sure I understand your comment. I know you cannot use __DATA__
> > in Apache::Registry scripts, and I thought when I tested that __DATA__
> > won't work in handlers.
>
> This is the __DATA__ section of 'search.cgi' that defines a simple template
> using Template-toolkit.
So, what's the qusetion?
The docs for search.cgi say:
The template can be placed in its own file if you like. That's the
normal way templates are used. It's in the __DATA__ section in this
script so that only one file is needed. If you run under mod_perl
or SpeedyCGI you must use a separate template file.
>
> >
> > Which version of CGI.pm do you have? I also see some notes about that
> > being an issue:
>
> CGI.pm following with ActiveState version 5.8.3
You can check like this:
$ perl -MCGI -le 'print $CGI::VERSION'
3.01
Although you might need different quotes on Windows.
>
> > http://perl.apache.org/docs/2.0/user/config/config.html#C_GlobalRequest_
> >
> >
> > > Note this works fine when changing it to not using SWISH:API (the
> > > 'swish.cgi')
>
>
> > You mean that just by setting use_library => 1 that you start getting
> > this error?
>
> No, when using 'search.cgi' the SWISH::API
Again, try explicitly setting +GlobalRequest in your config. Otherwise,
I'm just guessing since I don't use mod_perl 2. You might need to pass
$r to the CGI->new call:
sub handler {
my $r = shift;
process_request($r);
}
sub process_request {
my $r = shift;
my $cgi = CGI->new($r); # could also be Apache::Request or other fast access to CGI
my $query = $cgi->param('query');
Personally, I'd use Apache::Request under mod_perl 1. Should be a drop-in
replacement for CGI.pm except that you would also need to replace
$cgi->header. For mod_perl 2, you would need to look at the docs. I'm
not sure of the status of Apache::Request under mod_perl 2. I just see
examples using CGI.pm in the perl.apache.org docs.
--
Bill Moseley
moseley@hank.org
Received on Wed May 5 07:38:06 2004