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

Has anyone dealt with Activestate's PDK product? I'm trying to compile and include everything needed for CGI:Session but something isn't working. When I try to initialize the session object and then access it's id method I get an error :
Can't call method "id" on an undefined value at <scriptname>
Anyone familiar with PDK and/or CGI::session? Would greatly appreciate any help regarding this problem I'm having. Thanks.

Replies are listed 'Best First'.
Re: CGI::Session Compilation Issues
by Corion (Patriarch) on Feb 22, 2010 at 19:59 UTC

    You don't show us your code, but the "undefined value" means that you did not initialize a variable but try to use it as an object:

    my $session; # session is not defined print $session->id;

    Again, had you shown us the relevant parts of your script, we could help you more.

      My apologies. Never copied the example part of the question I had.
      #declared earlier using our $session = new CGI::Session("driver:File", undef, {Directory=>$perl_sessions}); #--- Storing the session id (this is where the browser complains $wCookie = $query->cookie(-name => "wweb", -value => $session->id);

        So $session is not defined. Either you didn't show the relevant parts of the script, as in, a self-contained, runnable, minimal script that reproduces the error, or the $session you're using to print is not the $session you declared further above. Also, read the CGI::Session documentation for ->new. It says Constructor. Returns new session object, or undef on failure. So, if there is an error when constructing the session, it might return undef. Maybe because your $perl_sessions directory does not exist.