Wed, Feb 09, 2000 at 04:34:08PM -0500 David Huang ΞΑΠΙΣΑΜ ΠΟ ΠΟΧΟΔΥ Re: Apach::Session 
with Sybase?

> I installed Vladimir's package, and run the main.pl script but got the
> following error:
> 
> Can't locate object method "TIEHASH" via package
> "Apache::Session::DBI::Sybase" at main.pl line 8.
> 
> Can you give a clue on what went wrong? Thank you!

A small example follows. Note that it's _not_ necessary to have Embperl in
order to run it. 

------------------------------------------------------------------

# sample calling program

package main;

use strict;

use Apache::Session::Embperl;
use Apache::Session::DBIStore::Sybase;

my %session;

unless ($ARGV[0]) {

        #make a fresh session for a first-time visitor
        tie %session, 'Apache::Session::Embperl', undef,
             {DataSource => 'dbi:Sybase:server=server;database=db',
              UserName   => 'user',
              Password   => 'password',
              object_store => 'Apache::Session::DBIStore::Sybase',
              lock_manager => 'SysVSemaphoreLocker'
             };

        #stick some stuff in it
        $session{visa_number} = "1234 5678 9876 5432";

        #get the session id for later use
        print $session{_session_id};

} else {

        #get the session data back out again
        # e.g., perl main.pl 209ea10a949e6aa1

        my %session;
        my $id = $ARGV[0];

        tie %session, 'Apache::Session::DBI', $id,
            {DataSource => 'dbi:Sybase:server=server;database=db',
             UserName   => 'user',
             Password   => 'password'
            };

        print $session{visa_number};

}

-- 
Best Regards
Vladimir Ivaschenko
http://www.hazard.maks.net/~hazard

Reply via email to