[Cgi-session-user] CGI::Session::Auth Error after CGI::Session Upgrade
Brought to you by:
sherzodr
From: Adam <ad...@sp...> - 2006-05-19 09:49:25
|
I upgraded CGI::Session from 3.95 to 4.11 and now I'm getting this error = when using CGI::Session::Auth::DBI Software error: Can't call method "isa" on an undefined value at = /usr/lib/perl5/site_perl/5.8.8/CGI/Session/Auth.pm line 52. Why is CGI::Session::Auth erroring out now? Is this a bug? This also = errors out from the command line. Here are the versions that I'm using: CGI::Session - 4.11 CGI::Session::Auth - 1.021 CGI::Session::Auth::DBI - 1.012 Perl 5.8.8 Here is line 52 of Auth.pm 49: foreach my $classParam (keys %classParams) { 50: croak "Missing $classParam parameter" unless exists = $params->{$classParam}; 51: croak "$classParam parameter is not a " . join(' or ', = @{$classParams{$classParam}}) . " object" 52: unless grep { $params->{$classParam}->isa($_) } = @{$classParams{$classParam}}; 53: } =20 Here is my code: #!/usr/bin/perl -w use strict; use CGI; use CGI::Carp ('fatalsToBrowser'); use CGI::Session; use CGI::Session::Auth::DBI; use CGI::Carp; use DBI; use Data::Dumper; my $cgi =3D new CGI; my $dbh =3D = DBI->connect("DBI:PgPP:dbname=3Ddb","username","password"); my $session =3D new CGI::Session("driver:PostgreSQL", undef, = {Handle=3D>$dbh}); my $auth =3D new CGI::Session::Auth::DBI({ CGI =3D> $cgi, Session =3D> $session, DBHandle =3D> $dbh,=20 UserTable =3D> 'users' }); print "Error\n" if ( not defined $auth ); $auth->authenticate(); =20 # check if visitor has already logged in if ($auth->loggedIn) { &showSecretPage; } else { &showLoginPage; } sub showLoginPage { print $cgi->redirect('https://192.168.0.1/login.html'); } =20 sub showSecretPage { print $session->header; print qq~<meta http-equiv=3D"refresh" = content=3D"0;URL=3Dhttps://192.168.0.1/">\n~; } HTML Login Page: <html> <head> <title>Login</title> <link rel=3D"stylesheet" href=3D"/css/style.css" type=3Dtext/css> </head> <body> <div id=3D"contentmain">=20 <p></p> <form name=3D"login" method=3Dpost action=3D"cgi-bin/auth.pl"> <table border=3D0 cellpadding=3D0 cellspacing=3D0> <tr> <td>Username: </td> <td><input name=3D"log_username" size=3D"15"></td> </tr> <tr> <td>Password: </td> <td><input name=3D"log_password" type=3D"password" size=3D"15"></td> </tr> <tr> <td colspan=3D2><input checked value=3D"1" name=3D"perm_cookie" = type=3D"checkbox"> Set me a permanent cookie <input value=3D"Login" class=3D"button" type=3D"submit"></td> </td> </tr> </table> </form> </body> </html> Here's the SQL to create the table in PostgreSQL. The username is "test" = with password "pass": -- -- PostgreSQL database dump -- SET client_encoding =3D 'LATIN1'; SET check_function_bodies =3D false; SET client_min_messages =3D warning; SET search_path =3D public, pg_catalog; SET default_tablespace =3D ''; SET default_with_oids =3D false; -- -- Name: users; Type: TABLE; Schema: public; Owner: dbusername; = Tablespace: -- CREATE TABLE users ( userid character varying(50) NOT NULL, first_name character varying(40) NOT NULL, last_name character varying(40) NOT NULL, passwd character varying(16) NOT NULL, email character varying(100) NOT NULL, privilege character varying(2) NOT NULL, username character varying(40) NOT NULL ); ALTER TABLE public.users OWNER TO dbusername; -- -- Name: userid; Type: DEFAULT; Schema: public; Owner: dbusername -- ALTER TABLE users ALTER COLUMN userid SET DEFAULT = nextval('"users_user_ID_seq"'::regclass); -- -- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: = dbusername -- COPY users (userid, first_name, last_name, passwd, email, privilege, = username) FROM stdin; 325684ec1b028eaf562dd484c5607a65 Allan Hubert pass = ad...@my... 0 test \. -- -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: = dbusername; Tablespace: -- ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (userid); -- -- PostgreSQL database dump complete -- |