in reply to carrying a lot of vars from page to page with hidden()

A question that might be related. If I run a CGI program using a subroutine for each page, normally variables from one subroutine/page will not be available to the other subroutines, which is the way Perl works, of course. However, if I access these variables by using something like print somesubroutine($variable) it doesn't play nice with CGI.pm - instead of returning post data, pages after the second just print the submit button again. (current state of the program is lists.bilkent.edu.tr/~robin/cgibin/tester.cgi.)

Originally posted as a Categorized Answer.

Replies are listed 'Best First'.
Re: Re: carrying a lot of vars from page to page with hidden()
by Ryszard (Priest) on Feb 01, 2003 at 08:38 UTC
    This is not really the way perl works as such, but more along the lines of the stateless nature of HTTP.

    There are numerous ways to maintain state that include:

    1. Tied hash
    2. A database
    3. regular old file
    4. hidden fields in the page...
    In fact any method of retrieving the data can be used. The interesting part of maintaining state come along when you want to retrieve the data associated with a particular "session". You have to work out a method of branding the browser, then retrieving that branding and associating it with the data you've stored server side.

    There are three main methods of branding a browser, cookies, in the URL and using hidden variables in your pages...

    I wont go into detail, however, there is a wealth of information available all over the web, and here on perl monks.