in reply to CGI::Session get the value of

Why are you looking at the internal structure of the object instead of the docs? Looks like ->param('message')

Replies are listed 'Best First'.
Re^2: CGI::Session get the value of
by Anonymous Monk on Dec 24, 2008 at 06:28 UTC
    Thanks, that doesn't work, which really puzzles me.
    $session->param('_SESSION_ATIME'); # works $session->param('message'); # doesn't work
    The first line works but the second doesn't (value is undef).

      You are likely starting a new session every page load.

      Try this for debugging, when the form pops up, print as part of the page (much better; STDERR if you got shell access) what the initial session id is, then in the next page (runmode that client submits to) print it out again, are they the same? I'm guessing 'no'.

      Why not?

      Last time i checked, CGI::Session does not take care of passing cookie by default. That is.. you create a session (a temporary storage likely in your server) but then.. how the heck do you know next time what session to fetch- if you have ten user clients? The user client has to tell the server what session- this is done in a variety of ways.You'll likely be using a cookie.

      Read the manuals. Read them again, and again. You will be reading a lot. More than that. You will see how reading the manual for thirty minutes is worth it when your coding takes five minutes to write and works the second time off.

      Ahahaha.. wait a second..
      In your receiving end.. you call session->param('message') immediately? Why ? Shouldn't you call cgi->param('message') ? Why would it be in session unless you specifically stored it there?

        Because Bob is Joe, and they're both Ed!!

        Thank you so much, leocharre.

        You're absolutely right. It makes sense now. It wasn't saved in the session but merely submitted via a CGI form. I should use cgi->param('message') instead.

        Cheers!