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

Hello fellow monks. Hope you're all doing great.

I have a little CGI issue right now. Can you give me a hand with that?

Here's the thing. I am developing a small site link verification program. Actually, the program is already developed...right now I'm working on the visual presentation of it. Since I was asked to make it a web page, I did it on CGI. I have all the code for the cgi and the whole process for the link verification in one file. It only accesses an external file to get the URL list. The CGI portion is object-based and quite simple right now, and it goes like this:
my $query = new CGI; print $query->header; print $query->start_html("Verificador de Ligas"); print "<H1> Verificaci&oacute;n de ligas</H1>\n"; #the whole process code goes here and start running automatically. print "Paginas verificadas: $ahora<br><br>"; print "Paginas no encontradas: $urlsmuertas<br>"; foreach(@dead_urls_to_keep) {print "$_<br>";} print "<br>Ligas con errores: $links_failed<br>"; foreach(@dead_links_to_keep) {print "$_<br>";} print $query->end_html;

There is something missing, however. I am required to place a counter, like a progress bar or something to measure the process, since it takes a while. Right now, the only thing I've came up with is a cheap print "$ahora de $total<br>"; this is, a list that goes "1 de 40 2 de 40, 3 de 40" and so on.

Any idea on how can I make a counter that doesn't flood the whole screen? I was thinking of doing a constant screen-refreshing with the progress, but I don't have a clue of how to do it. Also, it is not necessary to do everything in the same file, any ideas on how to do it with various files are also appreciated.

Thank you for reading and even more thanks for answering.
Cheers.

Replies are listed 'Best First'.
Re: Implementing a progress bar on CGI
by Ovid (Cardinal) on Mar 16, 2005 at 21:46 UTC

    There are a variety of ways to handle this. One way that I've been meaning to try is CGI::ProgressBar. It looks very easy, but it does require that your clients use javascript.

    Cheers,
    Ovid

    New address of my CGI Course.

      Works wonders, thanks a lot Ovid.
      Oh, and your tutorials are totally awesome!
      I learned a LOT about CGI from them. Thanks :)

        Glad you like the tutorials. I have a half-finished one sitting on my hard drive. It covers basic cookie usage and security. I really should finish that.

        Cheers,
        Ovid

        New address of my CGI Course.

Re: Implementing a progress bar on CGI
by FitTrend (Pilgrim) on Mar 16, 2005 at 21:57 UTC

    I've used this DHTML/Javscript loadingbar before. Its pretty good and an alternative to using a perl module if you need something quick and easy.

    demo of it is Here

    Hope it helps