Hello,
I've just installed a mod_perl enabled Apache and I am trying to configure
it. I ran into the "can't call register_cleanup on an undefined value"
while I was trying out the sample startup.pl file in the "Writing Apache
Modules in Perl and C" book. I did see the note about this in the
troubleshooting, but the fix didn't solve my problem.
Here's my httpd.conf:
...
Alias /perl/ /usr/local/apachemp/cgi-bin/
PerlPostReadRequestHandler 'sub { Apache->request(shift) }'
PerlModule Apache::Registry
PerlFreshRestart On
PerlRequire conf/startup.pl
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
allow from all
PerlSendHeader on
</Location>
<Location /hello/world>
SetHandler perl-script
PerlHandler Apache::Hello
</Location>
And here is conf/startup.pl...
#!/usr/local/bin/perl
BEGIN {
use Apache ();
use lib Apache->server_root_relative('lib/perl');
}
use Apache::Registry();
use Apache::Constants();
use CGI::Carp ();
use CGI qw(-compile :all);
1;
It dies on the use CGI qw(-compile :all); line, with the message:
[root@dungeon apachemp]# ./bin/apachectl configtest
[Tue Jul 31 00:54:54 2001] [error] [Tue Jul 31 00:54:54 2001] startup.pl:
[Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] CGI.pm:
Can't call method "register_cleanup" on an undefined value at
/usr/lib/perl5/5.6.0/CGI/Object.pm line 225.
[Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001]
startup.pl: BEGIN failed--compilation aborted at conf/startup.pl line 14.
[Tue Jul 31 00:54:54 2001] startup.pl: Compilation failed in require.
Syntax error on line 995 of /usr/local/apache/conf/httpd.conf:
[Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001]
startup.pl: [Tue Jul 31 00:54:54 2001] CGI.pm: Can't call method
"register_cleanup" on an undefined value at
/usr/lib/perl5/5.6.0/CGI/Object.pm line 225.
[Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001]
startup.pl: BEGIN failed--compilation aborted at conf/startup.pl line 14.
[Tue Jul 31 00:54:54 2001] startup.pl: Compilation failed in require.
[root@dungeon apachemp]#
I'm running the following versions of the software:
Apache 1.3.20
mod_perl 1.26
CGI.pm 3.02
I saw the note about it in the faq/troubleshooting section of the docs on
perl.apache.org, but as you can see I made the suggested change (the
PerlPostReadRequestHandler line in httpd) and I still get the error.
Any ideas? I'm not doing anything fancy, these are all default installs of
everything, just following the docs for installation and the book for the
startup.pl. The server starts and runs fine if I remove the use CGI
qw(-compile :all); line.
Thanks,
Fran