You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Pinate Aramsangrungroj <pi...@yahoo.com> on 2014/03/03 00:27:28 UTC

Can't call method "jar" without a package or object reference - mod_perl2

Hi,

We have just installed Auth handler
(Apache ) using mod_perl2 and CAS. 

1. Initially, we had the Internal
Server Error "Expected token not present", as per these
below links suggested this could be because of our invalid cookie
format. But for our application to work, we need those cookies

http://stackoverflow.com/questions/8594363/why-am-i-getting-a-expected-token-not-present-in-my-apache-log 
http://beutelevision.com/blog2/2012/05/25/quick-fix-for-expected-token-not-present-in-apache2cookie/ 

So we changed Cookie.pm as seen below 

Replace from 

my $jar = $req->jar or return;
$jar->cookie_class(__PACKAGE__); 
return $jar->get(shift) if @_; 
return wantarray ? %$jar : $jar; 

to 

my $jar = eval {$req->jar()} ||
$@->jar; #------------line 42 
eval{$jar->cookie_class(__PACKAGE__)}; 
return $jar->get(shift) if @_; 
return wantarray ? %$jar : $jar; 

My interpretation of the code in
line#42 is if there is some parsing error of cookie, ignore the error
and use that cookie anyway. 

2. This fixed the above error, all is
working fine in our internal network..we can browse the web
3. However, when we access the target
application from external via vpn and also with some browsers. We are
having below error 
Can't call method "jar"
without a package or object reference at
/usr/lib64/perl5/vendor_perl/Apache2/Cookie.pm 

Can someone shed some light into this?

FYI, based on my troubleshooting and
investigation I can see that there is still cookie parsing error from
executing eval {$req->jar()} in line 42, but somehow $@ is
undefined. 
Hence calling $@->jar cause such an
error. 

Don't know why it is only failing in
certain conditions as explained? Could anyone suggest some direction
or a possible solution? 

Thanks

Pinate