[Templates] print "n" nicely if n = bytes

Bill Ward bill@wards.net
Fri, 20 Oct 2006 13:22:45 -0700


By the way, the reason Number::Format doesn't do "giga" is that on 32
bit systems there can be overflow issues.

On 18 Sep 2006 16:27:52 -0700, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
> >>>>> "Bill" == Bill Ward <bill@wards.net> writes:
>
> Bill> I'm replying to email I saw on the list archives...
>
> Bill> Randal L. Schwartz <merlyn@stonehenge.com> wrote on 16 Sep 2006 16:22:26 -0700:
> >> [...] I tried using Template::Plugin::Number::Format and it
> >> didn't do what I wanted, so I wrote my own. I use this both for the bytes
> >> and for the file count, simply by applying the BLOCKSIZE scaling factor as
> >> needed.
>
> Bill> I'm the author of Number::Format which I have been sadly neglecting
> Bill> for a long time.  However I recently moved the project from my own CVS
> Bill> repository to SourceForge and started adding new developers.  One of
> Bill> these is Darren Chamberlain, the author of
> Bill> Template::Plugin::Number::Format.  That module is going to be made a
> Bill> part of the Number::Format project and released as part of
> Bill> Number::Format going forward.  Any patches, features, ideas, or other
> Bill> contributions you (or others on this list) might have to the
> Bill> Number::Format project would be welcomed.
> Bill> http://sourceforge.net/projects/number-format/
>
> The problem is that I wanted to get "the smallest string that fits
> into 5 chars".  I didn't see any option to do that... only options
> that control the number of digits past the decimal point.  If
> you see my code, you'll see that I switch from %f to %d when the
> value would overflow 4 chars (n.nn).
>
> Hmm.  %4g might have done the same thing. :)  But that's still not
> what "precision" means in format_bytes of Number::Format.
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
>


-- 
Help bring back the San Jose Earthquakes - http://www.soccersiliconvalley.com/