in reply to Re^2: Perl/CGI web page showing data by portions
in thread Perl/CGI web page showing data by portions

First of all, this is a bit dicey, and not real "webby," IMHO. Personally, I would just write it to the text box and let them scroll. Ideally, you would write the content to a <p> tag if you wanted to parse it out in chunks.

Second, you can't just assign all the content in the file to an array. How would you keep the value of the array between round trips to the browser? You will probably need to use read to retrieve a predetermined amount of content and then store a counter of where you are in a session key and increment it as the 'Next' link is clicked. On subsequent trips back to your script for more content, you would use the session key to offset the next amount of content from your file.

This is just one way I'm sure, but not real complicated.


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re^4: Perl/CGI web page showing data by portions
by vitaly (Acolyte) on Dec 08, 2007 at 22:26 UTC
    Brad, I completely agree with your recommendations. Scroll is fine. Reading predetermined ammount is also ok for me. I just need to start with something. If you could give me an example or good link with examples I would appreciate.
    Thanks, Vitaly

      Well, show us what you have. The monastery is not a place where the work is done for you without you showing your attempts.

      Having said that, a few clues: we should see 1) how the script is called in the first place, 2) how what is retrieved is determined, 3) the retrieval of the content, 4) the build and output of the HTML (or templating system), and 5) if you decide to go with an incremental method, the recalling of the script and method to lift and display the next piece.


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
        As I told I am not an expert. So, if possible, where can I read about creating text boxes and filling them out using perl/CGI

        You can start with CGI Tutorials. Those will get you well on your way. There is nothing like rolling up your sleeves and diving in. We all learn by our mistakes—no substitute for that.

        Highly recommend HTML::Template and eventually, when you get your CGI legs under you, CGI::Application


        —Brad
        "The important work of moving the world forward does not wait to be done by perfect men." George Eliot