AW: Can't locate object method "new" via package "CGI::Cookie"

"Andreas Mock" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Hi Vincent,

I don't have Debian. Therefor just a view hints.

1) CGI::Cookie loading is done sometimes dynamically via require. E.g. in
CGI.pm itself.
2) mod_perl 1/2 with the helper modules Apache2::RequestUtil interact
dynamically.
3) It can be possible that you have a version clash (alone or in combination
with other modules). Probably there was once pulled a module in your older
server which hinders the same behaviour.

Tests:
perl -MCGI::Cookie -E'say CGI::Cookie->VERSION'
perl -MApache2::RequestUtil -E'say Apache2::RequestUtil->VERSION'

On the other hand you can add debug code just before line
/home/lib/Marica/Base/login.pm line 198
to inspect the %INC hash to see whether CGI::Cookie was loaded somewhere.

You can also find the file Cookie.pm in your include path and put a
print STDERR map { "$_\n" } caller;
into it to find the location in Apache error log where it gets loaded in
the module stack.

Best regards
Andreas


-----Ursprüngliche Nachricht-----
Von: Vincent Veyron <[email protected]> 
Gesendet: Sonntag, 31. Mai 2020 20:50
An: [email protected]
Betreff: Can't locate object method "new" via package "CGI::Cookie"

Hi List,

I have two servers using mod_perl, both having the same modules installed
and enabled; server1 got a fresh install of Debian Buster, while server2 was
upgraded to Buster from Stretch.

This code :
	my $cookie = CGI::Cookie->new(-name  => 'session',
 				      -value => $session_id,
				      -domain => $hostname
	    ) ;

generates the following error on server2 :

[Sun May 31 19:54:03.053725 2020] [perl:error] [pid 30663] [client
83.113.48.133:59196] Can't locate object method "new" via package
"CGI::Cookie" (perhaps you forgot to load "CGI::Cookie"?) at
/home/lib/Marica/Base/login.pm line 198.\n, referer:
https://marica.fr/site/abonnes/index.html

It works fine if add "use CGI::Cookie" to my module. 

What could be the reason why it works on server1 without "use CGI::Cookie"
and not on server2?

-- 
https://compta.libremen.com
Logiciel libre de comptabilité générale en partie double
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.