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   => 'xxxx', #required when using
      Password   => 'xxxx', #MySQL.pm
      LockDataSource => 'dbi:mysql:sessions',
      LockUserName   => 'xxxx',
      LockPassword   => 'xxxx'
   };

  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


Reply via email to