Help for this page

Select Code to Download


  1. or download this
    # (mostly) From the tutorial link above-
    use strict; # Important!
    use warnings; # Ditto!
    ...
    Above line will first try to re-initialize an existing session by cons
    +ulting cookies and necessary QUERY_STRING parameters. If it fails wil
    +l create a brand new session with a unique ID, which is normally call
    +ed session ID, SID for short, and can be accessed through id() - obje
    +ct method.
    
    We didn't check for any session cookies above, did we? No, we didn't, 
    +but CGI::Session did. It looked for a cookie called CGISESSID, and if
    + it found it tried to load existing session from server side storage 
    +(file in our case). If cookie didn't exist it looked for a QUERY_STRI
    +NG parameter called CGISESSID. If all the attempts to recover session
    + ID failed, it created a new session.
    
  2. or download this
    use strict;
    use warnings;
    use CGI::Session;
    ...
        print h1("Welcome first time visitor");
    }
    $session->param( visits => $session->param("visits") + 1 );