You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Joshua Keroes <jo...@keroes.com> on 2004/05/18 22:01:41 UTC
Fwd: [Mason] Can't call method "register_cleanup" (CGI.pm)
Hello mod_perl folks:
I'm having some trouble getting the MasonHQ SiteSource code to run.
Looks like a mod_perl/CGI issue is the culprit.
This is what happens when I fire up Apache. (svrctl is a glorified
apachectl.)
> jkeroes@crux:/usr/local/anansi$ sudo bin/svrctl start dev
> Password:
> starting dev
> [Wed May 12 09:40:17 2004] [error] Can't call method "register_cleanup"
> on an undefined value at /usr/local/share/perl/5.8.3/CGI.pm line 318.\n
> Compilation failed in require at /usr/local/anansi/conf/handler-dev.pl
> line 12.\n
> Compilation failed in require at (eval 4) line 1.\n
> Syntax error on line 4 of /usr/local/anansi/conf/httpd-dev.conf:
> Can't call method "register_cleanup" on an undefined value at
> /usr/local/share/perl/5.8.3/CGI.pm line 318.
> Compilation failed in require at /usr/local/anansi/conf/handler-dev.pl
> line 12.
> Compilation failed in require at (eval 4) line 1.
>
> dev could not be started
> jkeroes@crux:/usr/local/anansi$ head -4 conf/httpd-dev.conf | tail -1
> PerlScript /usr/local/anansi/conf/handler-dev.pl
> jkeroes@crux:/usr/local/anansi$
Per Jonathan Swartz's advice, I replaced handler-dev.pl with a Hello
World handler and tried again:
> #!/usr/bin/perl
> use CGI;
> use strict;
>
> my $cgi = new CGI ({});
>
> sub handler
> {
> my ($r) = @_;
>
> $r->send_http_header;
> $r->print("Hello world!");
>
> return 200;
> }
Same error.
The docs at http://snipurl.com/6c0o (perl.apache.org/...) have this
error listed. The entry says:
> Can't call method "register_cleanup" (CGI.pm)
>
> Can't call method "register_cleanup" on an
> undefined value at /usr/lib/perl5/5.00503/CGI.pm line 263.
>
> caused by this code snippet in CGI.pm:
> if ($MOD_PERL) {
> Apache->request->register_cleanup(\&CGI::_reset_globals);
> undef $NPH;
> }
>
> One solution is to add to httpd.conf:
> PerlPostReadRequestHandler 'sub { Apache->request(shift) }'
>
> But even better, switch to Apache::Cookie:
> use Apache;
> use Apache::Cookie;
>
> sub handler {
> my $r = shift;
> my $cookies = Apache::Cookie->new($r)->parse;
> my %bar = $cookies->{foo}->value;
> }
I have tried both suggestions. Same error.
This is a Debian system.
I first tried to use system packages for mysql, Apache+mod_perl, Perl,
etc.
Perl 5.8.3, all pertinent modules updated to the latest-greatest from
CPAN:
apache-perl v1.3.29 (mod_perl v.1.29 staticly linked in)
Perl-5.8.3 (all modules updated to the latest-greatest via CPAN.pm)
CGI.pm v3.05
I rebuilt everything from source:
apache 1.3.31 (built using the Flexible method, lots of modules
compiled in)
perl-5.8.4 (all modules updated to the latest-greatest via CPAN.pm)
CGI.pm 3.05
mysql 11.16
How do I proceed forward and get this to work?
Much thanks for any help you can provide,
Joshua
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [Mason] Can't call method "register_cleanup" (CGI.pm)
Posted by Joshua Keroes <jo...@keroes.com>.
> Joshua Keroes wrote:
>> I'm having some trouble getting the MasonHQ SiteSource code to run.
>> This is what happens when I fire up Apache.
>>
>>> jkeroes@crux:/usr/local/anansi$ sudo bin/svrctl start dev
>>> Password:
>>> starting dev
>>> [Wed May 12 09:40:17 2004] [error] Can't call method
>>> "register_cleanup"
>>> on an undefined value at /usr/local/share/perl/5.8.3/CGI.pm line
>>> 318.\n
>>> Compilation failed in require at
>>> /usr/local/anansi/conf/handler-dev.pl
>>> line 12.\n
>>
>> Per Jonathan Swartz's advice, I replaced handler-dev.pl with a Hello
>> World handler and tried again:
>>
>>> #!/usr/bin/perl
>>> use CGI;
>>> use strict;
>>>
>>> my $cgi = new CGI ({});
>>>
>>> sub handler
>>> {
>>> my ($r) = @_;
>>>
>>> $r->send_http_header;
>>> $r->print("Hello world!");
>>>
>>> return 200;
>>> }
>>
>> Same error.
On May 18, 2004, at 10:51 PM, Stas Bekman wrote:
> You can't cache CGI objects used for request parsing. Move that
>
> my $cgi = new CGI ({});
>
> *inside* the handler. Apache->request is obviously not available at
> startup
> time.
>
> And you really want to start using the new syntax, CGI->new($r), since
> you
> will want it for mp2 when you move to it.
Thanks, Stas -
That did the trick.
Cheers,
Joshua
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Fwd: [Mason] Can't call method "register_cleanup" (CGI.pm)
Posted by Stas Bekman <st...@stason.org>.
Joshua Keroes wrote:
>
> Hello mod_perl folks:
>
> I'm having some trouble getting the MasonHQ SiteSource code to run.
> Looks like a mod_perl/CGI issue is the culprit.
>
> This is what happens when I fire up Apache. (svrctl is a glorified
> apachectl.)
>
>> jkeroes@crux:/usr/local/anansi$ sudo bin/svrctl start dev
>> Password:
>> starting dev
>> [Wed May 12 09:40:17 2004] [error] Can't call method "register_cleanup"
>> on an undefined value at /usr/local/share/perl/5.8.3/CGI.pm line 318.\n
>> Compilation failed in require at /usr/local/anansi/conf/handler-dev.pl
>> line 12.\n
>> Compilation failed in require at (eval 4) line 1.\n
>> Syntax error on line 4 of /usr/local/anansi/conf/httpd-dev.conf:
>> Can't call method "register_cleanup" on an undefined value at
>> /usr/local/share/perl/5.8.3/CGI.pm line 318.
>> Compilation failed in require at /usr/local/anansi/conf/handler-dev.pl
>> line 12.
>> Compilation failed in require at (eval 4) line 1.
>>
>> dev could not be started
>> jkeroes@crux:/usr/local/anansi$ head -4 conf/httpd-dev.conf | tail -1
>> PerlScript /usr/local/anansi/conf/handler-dev.pl
>> jkeroes@crux:/usr/local/anansi$
>
>
>
> Per Jonathan Swartz's advice, I replaced handler-dev.pl with a Hello
> World handler and tried again:
>
>> #!/usr/bin/perl
>> use CGI;
>> use strict;
>>
>> my $cgi = new CGI ({});
>>
>> sub handler
>> {
>> my ($r) = @_;
>>
>> $r->send_http_header;
>> $r->print("Hello world!");
>>
>> return 200;
>> }
>
>
> Same error.
You can't cache CGI objects used for request parsing. Move that
my $cgi = new CGI ({});
*inside* the handler. Apache->request is obviously not available at startup time.
And you really want to start using the new syntax, CGI->new($r), since you
will want it for mp2 when you move to it.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html