Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Batch processing progress printerby Aristotle (Chancellor) |
on Oct 24, 2004 at 03:48 UTC ( [id://401963]=CUFP: print w/replies, xml ) | Need Help?? |
I have a bunch of scripts that process several batches of “things”, whatever those may be, where each batch may or may not contain processible “things”. F.ex, that might be a list of directories of which each may or may not contain files to process, or an email folder full of messages that may have one or more files attached (see attachments — mass-dumps file attachments from mail), or such. Usually, I want progress indication in the form of dir1: file2, file8, file9 dir3: file6 dir4: file1, file2, file3 The following snippet contains a function generator that does the job. Use it as in:
If you are processing batches with very large items, don't forget to unbuffer the output handle so you see the intermediate updates immediately.
Back to
Cool Uses for Perl
|
|