Perl: the Markov chain saw | |
PerlMonks |
Re: Progress Barby tmoertel (Chaplain) |
on Oct 06, 2004 at 03:14 UTC ( [id://396857]=note: print w/replies, xml ) | Need Help?? |
(Updated: Something bad happened to the code portion during cut-and-paste to the site. This is now fixed.)
Here's a quick bit of code that provides a simple, object-oriented way to draw progress bars. To use it, just create a progress bar like so: (Here, our bar will be 40 characters wide.) Then, to draw the bar, just pass in the current count of completed tasks and the total number of tasks: So, in the above example, we have completed 3 of 10 tasks and the following would be drawn: A couple of points:
Here's the code: Hope this helps. Cheers, Tom Moertel : Blog / Talks / CPAN / LectroTest / PXSL / Coffee / Movie Rating Decoder
In Section
Seekers of Perl Wisdom
|
|