HELP: mod_perl and Apache::Cookie

2001-12-17 Thread Philip M. Gollucci

given the following setup:
Embedded Perl version v5.6.1 for Apache/1.3.22 (Unix) mod_python/2.7.6
Python/2.1.1 PHP/4.0.6 mod_perl/1.26 process 8458,

uname -a
FreeBSD xxx.com 4.4-RELEASE FreeBSD 4.4-RELEASE #1: Thu Dec
13 08:25:04 EST 2001
[EMAIL PROTECTED]:/usr/src/sys/compile/PHILIP  i386

Someone Please Tell me what I am missing with Apache::Cookie

because the folling script works fine if I:
replace Apache::Cookie-new($r,   with cookie() from CGI


Error log Messages:
[Sun Dec 16 16:36:57 2001] [error] Died at
/usr/home/src/perl/lib/site_perl/5.6.1/Apache/Session/Generate/MD5.pm line 40.

Which Is
sub validate {
#This routine checks to ensure that the session ID is in the form
#we expect.  This must be called before we start diddling around
#in the database or the disk.

my $session = shift;

if ($session-{data}-{_session_id} !~ /^[a-fA-F0-9]+$/) {
die;### LINE 40#
}
}



Now the Following Script assume its in the right place for Apache::Registry
handler.

#!/usr/local/bin/perl -w

use strict;
use diagnostics;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser carpout);   # Send Error Messages to Browswer
use Apache;
use Apache::Cookie;
use Apache::Session::MySQL;

main();

sub main() {
  my $r = Apache-request;
  my %params = $r-method eq 'POST' ? $r-content : $r-args;
  my %session = undef;

  my $cookie = undef;
  my $valid = undef;
  my $sid = undef;

  $sid = Apache::Cookie-new($r, -name=SID03);

  tie %session, 'Apache::Session::MySQL', $sid, {
  DataSource = 'dbi:mysql:sessions', #these arguments are
  UserName   = '', #required when using
  Password   = '', #MySQL.pm
  LockDataSource = 'dbi:mysql:sessions',
  LockUserName   = '',
  LockPassword   = ''
   };

  if ($sid == undef) {
  $cookie = Apache::Cookie-new($r, -name='SID03',
-value=$session{_session_id},
-expires='+10m',
-path=/perl-reg/Admin);
};

$sid = $session{_session_id};

$cookie-bake;
$r-internal_redirect_handler(/perl-reg/Admin/main.cgi);

return;
}


--
Philip M. Gollucci (p6m7g8) [EMAIL PROTECTED] 301.314.3118

Science, Discovery,  the Universe (UMCP)
Webmaster  Webship Teacher
URL: http://www.sdu.umd.edu

EJPress.com
Database/PERL Programmer  System Admin
URL : http://www.ejournalpress.com

Resume  : http://www.p6m7g8.com/resume.txt





Re: HELP: mod_perl and Apache::Cookie

2001-12-17 Thread Michael G Schwern

On Sun, Dec 16, 2001 at 04:38:44PM -0500, Philip M. Gollucci wrote:
 given the following setup:
 Embedded Perl version v5.6.1 for Apache/1.3.22 (Unix) mod_python/2.7.6
 Python/2.1.1 PHP/4.0.6 mod_perl/1.26 process 8458,
 
 uname -a
 FreeBSD xxx.com 4.4-RELEASE FreeBSD 4.4-RELEASE #1: Thu Dec
 13 08:25:04 EST 2001
 [EMAIL PROTECTED]:/usr/src/sys/compile/PHILIP  i386
 
 Someone Please Tell me what I am missing with Apache::Cookie
 
 because the folling script works fine if I:
 replace Apache::Cookie-new($r,   with cookie() from CGI
snip

I think you may have strayed onto the wrong mailing list.  This is the
list for discussing Perl's QA infrastructure.  Figuring out why
mod_perl is spitting on you would better be done on one of the
mod_perl mailing lists here:
http://perl.apache.org/#maillists


If anyone one on perl-qa wants to help out, just make sure you don't
CC the list.

-- 

Michael G. Schwern   [EMAIL PROTECTED]http://www.pobox.com/~schwern/
Perl Quality Assurance  [EMAIL PROTECTED] Kwalitee Is Job One
There is nothing wrong.  We have taken control of this sig file.  We will 
return it to you as soon as you are groovy.