Skip Menu |

This queue is for tickets about the CGI-Simple CPAN distribution.

Report information
The Basics
Id: 67961
Status: open
Priority: 0/
Queue: CGI-Simple

People
Owner: Nobody in particular
Requestors: szabgab [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Can't call method "pool" on unblessed reference at /usr/lib/perl5/site_perl/5.10.0/CGI/Simple.pm line 235.
Date: Thu, 5 May 2011 11:58:18 +0300
To: bug-CGI-Simple [...] rt.cpan.org
From: Gabor Szabo <szabgab [...] gmail.com>
Using CGI::Simple in mod_perl environment if I have a call like this: my $q = CGI::Simple->new({ x => 42 }); I get an exception: Can't call method "pool" on unblessed reference at /usr/lib/perl5/site_perl/5.10.0/CGI/Simple.pm line 235. A workaround would be: { no warnings; sub CGI::Simple::_mod_perl { }; $q = CGI::Simple->new({ x => 42 }); } or also: { local *{CGI::Simple::_mod_perl} = sub {}; $q = CGI::Simple->new({ x => 42 }); } and in perl 5.12 probably this would also work: { local delete $ENV{MOD_PERL}; local delete $ENV{GATEWAY_INTERFACE}; $q = CGI::Simple->new({ x => 42 }); } but I have not tested this. I am not sure how to write a unit test for this case and how to really fix it in the code of CGI::Simple. Using CGI::Simple 1.113 on perl 5.10 SUSE Linux Gabor
On Thu May 05 04:58:26 2011, szabgab@gmail.com wrote: Show quoted text
> Using CGI::Simple in mod_perl environment if I have a call like this: > > my $q = CGI::Simple->new({ x => 42 }); > > I get an exception: > > Can't call method "pool" on unblessed reference at > /usr/lib/perl5/site_perl/5.10.0/CGI/Simple.pm line 235. > >
not sure if its the best way but this seems to fix the issue diff -ruN CGI-Simple-1.113/lib/CGI/Simple.pm CGI-Simple-1.11301/lib/CGI/Simple.pm --- CGI-Simple-1.113/lib/CGI/Simple.pm 2010-12-27 05:11:19.000000000 -0800 +++ CGI-Simple-1.11301/lib/CGI/Simple.pm 2011-11-02 21:00:42.750000000 -0700 @@ -13,7 +13,7 @@ $NPH $DEBUG $NO_NULL $FATAL *in ); -$VERSION = "1.113"; +$VERSION = "1.11301"; # you can hard code the global variable settings here if you want. # warning - do not delete the unless defined $VAR part unless you @@ -179,7 +179,7 @@ my $self = {}; bless $self, $class; if ( $self->_mod_perl ) { - if ( $init ) { + if ( $init and (UNIVERSAL::isa( $init,'Apache') || UNIVERSAL::isa( $init,'Apache2::RequestRec')) ) { $self->{'.mod_perl_request'} = $init; undef $init; # otherwise _initialize takes the wrong path }