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

Respected Monks,

I am playing with session management, and want to use CGI::Session/MySQL for the job. I  use CGI::Session at the top of my program, and set up the session with this code: $session = new CGI::Session("driver:MySQL", undef, {Handle=>$dbh});.

I am getting this error message
Can't locate object method "new" via package "CGI::Session" (perhaps y +ou forgot to load "CGI::Session"?)

I am hosted with pair, and CGI::Session is listed as an installed module. My code is pretty much copied from the docs at search.cpan.org. Could someone please help me discover what I am doing wrong?

Thanks much as always,
digger

Replies are listed 'Best First'.
Re: CGI::Session- strange error
by leriksen (Curate) on May 19, 2003 at 03:26 UTC
    another check that all the path issues/version etc are straight - try
    use CGI::Session; print $CGI::Session::VERSION;
    or if you have a shell perl -MCGI::Session -e 'print $CGI::Session::VERSION' have a look and see if @INC makes sense too
    perl -e 'print map {"$_\n"} @INC'
      Thanks for the one-liners. I have some canned scripts I have used in the past (probably lifted from right here at the monestary) to look at these issues on my own boxes.

      Since I am working in a new arena here, I assumed it was my problem, not the hosting company's. But, it turns out the version of CGI::Session is at 0.01. I am going to install the newest version of the module in my local lib directory and use it that way for now.

      Thanks again,
      digger
Re: CGI::Session- strange error
by WhiteBird (Hermit) on May 18, 2003 at 22:53 UTC
    You might not be doing anything wrong. It's a stretch, but have you checked with your hosting company (pair) to make sure that the module is correctly installed and working on their server? I had similar problems with a Win32 module on a different hosting company. The hosting service documentation indicated that it was available, but when the support staff actually checked my particular server, the module was not there after all. Leave no stone unturned....