The documentation is very confusing, but between reading the source code and rereading the docs, here's how it works:
- min is the starting unit, e.g. 0
- max is the ending unit, e.g. 100 or 1000
or in your case, maybe number of files or total number of Gb
- report($format, $cur) - prints out how much has been done so far using the format $format. $cur is the number of units consumed so far, i.e. the number of files or number of Gb examined so far
- time estimates are calculated by comparing the lapsed time to $cur/($max - $min) and scaling up appropriately.
So the usage would be something like:
- create a progress object with appropriate min/max
- in a loop,
- do N units of work
- after each N units have been completed, call report($format, $cur) to report how many units have been completed so far
BTW - I also noted the docs show report like this report(format, [current item]). I'm not quite sure what was intended by that. According to the source code, the call should look like this: report($format, $currentItem)
Best, beth
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|