Re: [Cgi-session-user] a bug or two related to _load_pluggables? (was: Problem With CGI::Session v.
Brought to you by:
sherzodr
From: Ulrike S. <ul...@go...> - 2008-01-26 23:02:22
|
Hi, I was bitten by the same problem. The suggested workaround (explicitly naming the serializer, driver and ID generator) helps, but I do have to include the line "use CGI::Session::ID::md5;". In the log I found the message: Bareword found where operator expected at /usr/lib/perl5/site_perl/5.8.8/CGI/Session/Serialize/default.pm line 22, near "new Data::Dumper",(Do you need to predeclare new?) So I changed the line: < my $d = < new Data::Dumper([$data], ["D"]); --- > my $d = Data::Dumper->new([$data], ["D"]); Now the defaults work without the workaround, but I get the following line in my log: (in cleanup) Can't call method "new" without a package or object reference at /usr/lib/perl5/site_perl/5.8.8/CGI/Session/Serialize/default.pm line 21 Not sure what this is supposed to mean ... Uli > > I just wanted to create a new session and got some errors. My code is > > the following: > > > > use strict; > > use Env; > > use File::Basename; > > use DBI; > > use lib dirname(__FILE__) . ''; > > use CGI; > > use CGI::Carp "fatalsToBrowser"; > > use CGI::Session; > > use CGI::Session::ID::md5; > > use Digest::MD5 qw(md5 md5_hex md5_base64); > > > > my $sid = md5($ENV{UNIQUE_ID}); > > my $cgi = new CGI; > > > > #print "Content-Type: text/html\n\n"; > > print $cgi->start_html( > > > > -title => 'Switch.cgi', > > -author => 'UlrichW.External@qi...' > > ); > > #print $sid; > > my $session = new CGI::Session(undef, undef, > > {Directory=>'/tmp/session'}) or die CGI::Session->errstr; > > $sid = $session->id(); > > print $sid; > > > > The error-message is the folowing: > > > > session.cgi: Use of uninitialized value in concatenation (.) or string > > at /opt/webserver/software/perl/lib/5.6.1/CGI/Session.pm line 128. > > Can't locate object method "generate_id" via package > > "CGI::Session::ID::" at > > /opt/webserver/software/perl/lib/5.6.1/CGI/Session.pm line 74. > > > > I'm using Perl-Version 5.6.1 > > CGI.pm has the version 3.05 > > And Session.pm has the version 4.20 > > Ulrich, > > First, you can remove this line: It shouldn't be needed: > > > use CGI::Session::ID::md5; > > I see what looks like a bug (or two), but I don't understand why it > wouldn't > affect more people. > > First bug: > - 'sub _id_generator' uses a variable without checking to see if it > exists first. If it did, it could have returned a more friendly error > message than the one you got. > (This is not causing your problem, but is related). > > Second bug: > - 'sub _load_pluggables' takes care of loading a default ID generator, > and putting the result in $self->{_DSN}{id}, which doesn't seem to > be happening for you. > > Look at line 798 in CGI/Session.pm: > > $dsn->{ $plug } = $mod_name = $1; > > By using Data::Dumper and 'warn', inspect the values > of '$dsn->{$plug}' and '$mod_name' before and after that line. > > By continuing to debug in 'sub _load_pluggables', I think you'll find > the issue. Maybe it's something related to Perl 5.6.1 being older? > Did the whole test suite pass for you OK? > > If you need an immediate result, the workaround seems to be explicitly > name the serializer, driver and ID generator you want in the DSN. > > Mark |