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

Hi Monks, I am facing a data persitence problem. In my application, on a web page I am taking a file(report file) name from the user and then printing that file on the browser itself. Similarly i have to print few specified lines from the same report file and print them on the browser. For that i don't want to take the any input from the user but while making another request to the web server the inputs initially taken are lost. So, i am writing them to a file and using them again later on. Now the problem is when i am running multiple instances of the same application, the file is overwritten and i am not able to associate the data with each request. kindly help me, so either i could save the data of the initial request made or could associate data with each server request. Thanks in advance.!!!

Replies are listed 'Best First'.
Re: data persistence
by wfsp (Abbot) on Dec 12, 2007 at 15:23 UTC
    Also have a look at CGI::Session

    As the first line of the docs says:

    CGI::Session - persistent session data in CGI applications
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: data persistence
by olus (Curate) on Dec 12, 2007 at 15:30 UTC
    I didn't fully understand how you make the subsequent requests, but there are two simple ways of knowing the initial information.
    1. Use hidden form input fields on the pages you show to the users after the first request.
    2. Use a cookie to store that information

    In both cases you can use the module CGI to get the hidden form fields or set and read the cookie.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: data persistence
by citromatik (Curate) on Dec 12, 2007 at 15:01 UTC

    File::Temp is the module you are looking for.

    citromatik