Hi William;

On Mon, 04 Jun 2001, William McKee scribed:

> The error message indicates that Perl cannot find the Session.pm 
> module. Be sure you have installed the module properly. If you have to
> install it locally on an ISP, then you'll need to add:
>  use lib '/path/to/your/modules/';

Thanks for your time I do appreciate it.

You were indeed correct ..once I installed Session.pm module properly it
works fine...doe!

My next attempt at sessions was with Sessions & DBI.

I installed Apache-Session-1.53 according to the "INSTALL" docs...

perl Makefile.PL
make install

And it seems to install just fine...but the little program below barfs
out this error;

Can't locate object method "request" via package "Apache" at session2.cgi line 16

As I mentioned it seems to install Apache-Session just fine...but I went
back and did "make clean" then "make", "make test" and I got the
following error...

t/99md5gen..........ok
t/99mysql...........DBI->connect(sessions)
failed: Access denied for user: '@localhost'
to database 'sessions' at blib/lib/Apache/Session/Lock/MySQL.pm line 36
dubious
        Test returned status 255 (wstat 65280, 0xff00)
Undefined subroutine &Test::Harness::WCOREDUMP
called at /usr/lib/perl5/5.00503/Test/Harness.pm line 288.
make: *** [test_dynamic] Error 255

Is this nothing more than the fact that no "user" is specified with
'@localhost' as well as no password...or is this something that may
cause the script error

Can't locate object method "request" via package "Apache" at session2.cgi line 16

or is there a problem with the "snippet" below.??

Is there a way to run "make test" and pass the user and  password...so
the test will run?  

I tried the usual -uuser -ppassword with "make test" and that did not
work.

Thanks for your time and troubles.

 ----------- snippet -------------------------

             #!/usr/bin/perl -w

              use strict;
              use DBI;
              use Apache::Session::DBI;
              use CGI;

              # [...]

              # Initiate a session ID
              my $session = ();
              my $opts = {  autocommit => 0,
                            lifetime   => 3600 };     # 3600 is one hour

              # Read in the cookie if this is an old session
              my $r = Apache->request;
              my $no_cookie = '';
              my $cookie = $r->header_in('Cookie');
              {
                  # eliminate logging from Apache::Session::DBI's use of `warn'
                  local $^W = 0;

                  if (defined($cookie) && $cookie ne '') {
                      $cookie =~ s/SESSION_ID=(\w*)/$1/;
                      $session = Apache::Session::DBI->open($cookie, $opts);
                      $no_cookie = 'Y' unless defined($session);
                  }
                  # Could have been obsolete - get a new one
                  $session = Apache::Session::DBI->new($opts) unless defined($session);
              }

              # Might be a new session, so let's give them a cookie back
              if (! defined($cookie) || $no_cookie) {
                  local $^W = 0;

                  my $session_cookie = "SESSION_ID=$session->{'_ID'}";
                  $r->header_out("Set-Cookie" => $session_cookie);
              }

----------- snippet -------------------------

> On 3 Jun 2001, at 19:38, Michael Chopek wrote:
> 
> > Hi Folks;
> > 
> > I'm trying to get a handle on using "sessions" so I have been trying to
> > get through the docs at;

<SNIPPAGE>

> > Can't locate object method "new" via package "Session" at main.cgi line
> > 7.

-- 

       best regards
                -michael



Reply via email to