You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Fran Fabrizio <fr...@momsmeatballs.net> on 2001/07/31 07:49:08 UTC

Can't solve the CGI/pm "Can't call register_cleanup" problem

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


Re: Can't solve the CGI/pm "Can't call register_cleanup" problem

Posted by Ron Savage <ro...@savage.net.au>.
Fran

See below.

Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html

> use CGI qw(-compile :all);

There's a typo in the book. Chop '-compile'.



Re: Can't solve the CGI/pm "Can't call register_cleanup" problem

Posted by Stas Bekman <st...@stason.org>.
On Tue, 31 Jul 2001, Fran Fabrizio wrote:

>
> 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.

CGI.pm 3.02 is an alpha version. I'm not sure about its interoperability
with mod_perl. Get the 2.x version to solve the problem asap.

> 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
>



_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/