in reply to Subroutine for showing the end user the progress of the program

If you want something simpler than a status bar, on a text based STDOUT, I've occasionally used something like this (pseudocode)

$length = 1; while (doing operation) { for (1..$length){print "\b"} print $numberOfRecords; $length = length($numberOfRecords); }

In other words, for each iteration of your loop, print the number of \b's equal to the string length of your last status message, then print your status message again. That way you get a constantly changing status message on STDOUT, rather than a scrolling '1 records\n','2 records\n' etc

I hope that makes sense!

VGhpcyBtZXNzYWdlIGludGVudGlvbmFsbHkgcG9pbnRsZXNz
  • Comment on Re: Subroutine for showing the end user the progress of the program
  • Download Code

Replies are listed 'Best First'.
Re^2: Subroutine for showing the end user the progress of the program
by ghenry (Vicar) on Feb 02, 2005 at 14:47 UTC

    Sure does!!!

    Just getting into the best language ever... Fancy a yourname@perl.me.uk? Just ask!!!