awohld has asked for the wisdom of the Perl Monks concerning the following question:
Why is CGI::Session::Auth::DBI erroring out now? Is this a bug? This also errors out from the command line. Here are the versions that I'm using:Software error: Can't call method "isa" on an undefined value at /usr/lib/perl5/site_p +erl/5.8.8/CGI/Session/Auth.pm line 52.
HTML Login Page:#!/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; # CGI object for headers, cookies, etc. my $cgi = new CGI; my $dbh = DBI->connect("DBI:PgPP:dbname=db","username","password"); my $session = new CGI::Session("driver:PostgreSQL", undef, {Handle=> +$dbh}); my $auth = new CGI::Session::Auth::DBI({ CGI => $cgi, Session => $session, DBHandle => $dbh, UserTable => 'users' }); print "Error\n" if ( not defined $auth ); $auth->authenticate(); # 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'); } sub showSecretPage { print $session->header; print qq~<meta http-equiv="refresh" content="0;URL=https://192.168 +.0.1/">\n~; }
<html> <head> <title>Login</title> <link rel="stylesheet" href="/css/style.css" type=text/css> </head> <body> <div id="contentmain"> <p></p> <form name="login" method=post action="cgi-bin/auth.pl"> <table border=0 cellpadding=0 cellspacing=0> <tr> <td>Username: </td> <td><input name="log_username" size="15"></td> </tr> <tr> <td>Password: </td> <td><input name="log_password" type="password" size="15"></td> </tr> <tr> <td colspan=2><input checked value="1" name="perm_cookie" type="che +ckbox"> Set me a permanent cookie <input value="Login" class="button" type="submit"></td> </td> </tr> </table> </form> </body> </html>
-- -- PostgreSQL database dump -- SET client_encoding = 'LATIN1'; SET check_function_bodies = false; SET client_min_messages = warning; SET search_path = public, pg_catalog; SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: users; Type: TABLE; Schema: public; Owner: dbusername; Tables +pace: -- 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: dbus +ername -- COPY users (userid, first_name, last_name, passwd, email, privilege, u +sername) FROM stdin; 325684ec1b028eaf562dd484c5607a65 Allan Hubert pass adam@m +ysite.org 0 test \. -- -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: dbuserna +me; Tablespace: -- ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (userid); -- -- PostgreSQL database dump complete --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI::Session::Auth::DBI Error
by gellyfish (Monsignor) on May 19, 2006 at 09:14 UTC | |
by awohld (Hermit) on May 19, 2006 at 09:51 UTC |