leocharre has asked for the wisdom of the Perl Monks concerning the following question:

Ok. I want to use apache Apache::Session::MySQL. Awesome. Looks really pretty. Sexy stuff.

I'm looking over it at cpan, and it's a little comfusing.

I should obviously create a database for it- right?

I should also make a table for it?

Do I have to predetermine what the data will be, that is- a table layout? in which case this is useless..

Thanks in advance for any help.

update: ( thanks mbeast ) ok, got further. still no cigar.
I get this:

Can't connect to data source , no database driver specified and DBI_DS +N env var not set at /usr/lib/perl5/site_perl/5.8.3/Apache/Session/Lo +ck/MySQL.pm line 36 (in cleanup) Can't connect to data source , no database driver + specified and DBI_DSN env var not set at /usr/lib/perl5/site_perl/5. +8.3/Apache/Session/Lock/MySQL.pm line 36

I *know* my connect info is correct. I have a proper table in the db too..

I'm using a db handle

&openDBH; # subroutine that # places open handle globally accessible at $DBH my %session; tie %session, 'Apache::Session::MySQL', undef, { Handle => $DBH, TableName => 'sessions2' };

I'm giving up on this one soon..

Replies are listed 'Best First'.
Re: setting up to use Apache::Session::MySQL
by mbeast (Beadle) on Feb 14, 2006 at 14:41 UTC
      thing with CGI::Session.. that it's nice for single pairs, but what i want.. is some hash and array play.. storing a list in session, for example. apache::session seems to do that kind of thing.. so many people put work into it! i feel like a moron not using it. i'll have to try again sometime- thank you!!
        thing with CGI::Session is that it's nice for single pairs, but what i want is some hash and array play.

        I don't think that's true. From cgi session tutorial:

        It's possible to handle very big and even complex (in-memory) data structures transparently.
Re: setting up to use Apache::Session::MySQL
by EvanCarroll (Chaplain) on Feb 15, 2006 at 01:03 UTC
    Print dumper for $DBH... it isn't right:
    use Data::Dumper; print Dumper $DBH

    Additionally::
    my %session; tie %session, 'Apache::Session::MySQL', undef,
    Is probably better written tie my %session, 'Apache::Session::MySQL', undef,


    Evan Carroll
    www.EvanCarroll.com