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

Brad,
Chunk of data will be just a file with strings. This file is huge and a part of it will be read by Perl program by some portions which, say, fit the text box. The next portion will be retrieved by pressing <next>.
No problem with reading file portion to, say, array of strings. The question is how to show the portion in the text box and create request to read another portion.
Thanks, Vitaly
  • Comment on Re^2: Perl/CGI web page showing data by portions

Replies are listed 'Best First'.
Re^3: Perl/CGI web page showing data by portions
by bradcathey (Prior) on Dec 08, 2007 at 20:14 UTC

    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
      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
Re^3: Perl/CGI web page showing data by portions
by olus (Curate) on Dec 09, 2007 at 14:14 UTC
    For that you will need to be familiar with HTML forms.
    W3 Schools has online tutorials that should get you started.