in reply to CGI::Session - trouble passing variables

Sorry, your code doesn't compile:

> perl -c SCRIPT2.PL Global symbol "$sid" requires explicit package name at SCRIPT2.PL line + 10. Global symbol "$session" requires explicit package name at SCRIPT2.PL +line 12. Global symbol "$session" requires explicit package name at SCRIPT2.PL +line 20.
I use CGI::Session every day and it works real well for me.

Ciao, Valerio

Replies are listed 'Best First'.
Re: Re: CGI::Session - trouble passing variables
by Lori713 (Pilgrim) on Mar 01, 2004 at 22:28 UTC
    As I mentioned in the initial post, both $sid and $session are carried through and re-called by the function &call_vars (and my use strict would have complained loudly about undeclared variables). It works very well for me on every other variable I move from one page to another. However, maybe I shouldn't try to carry $sid and $session like the other variables even though they're scalar variables and the hidden field method I was using works well.

    I was considering CGI::Session because I needed to pass along a referenced array used in my HTML::Template. Hidden fields would not work for a referenced array, so I was looking for something to maintain persistent state. Thanks for taking a look at it.

    Lori

      You're not trying to pass $session through the form right? You're supposed to retrieve the session using $session = CGI::Session->new('driver:File',$sid,{Directory=>'/blah'};. Only the session id should be passed to the page.

      antirice    
      The first rule of Perl club is - use Perl
      The
      ith rule of Perl club is - follow rule i - 1 for i > 1

        Actually, I've tried it several ways... passing each, passing both, not passing any, not passing one or the other...

        I also tried putting the retrieval code at the top of the next .pl so it would pull the session ID. It keeps coming back as "1" (which my guess would be that means "true" or "false".

        Thanks for everyone's replies. Unfortunately, I am running out of time and have opted to go with an uglier method just so I can meet my deadline (well, actually, the deadline was February 1st) as best I can. I hope to get back to it after the crunch of user testing and see if I can figure out a cleaner, more maintainable code.

        I appreciate everyone's help!

        Lori