1Format::Human::Bytes(3)User Contributed Perl DocumentatioFnormat::Human::Bytes(3)
2
3
4
6 Format::Human::Bytes - Format a bytecount and make it human readable
7
9 Version 0.02
10
12 Ever showed 12345678 bytes to the user instead of just saying 11MB?
13 This module returns you a printable string which is more readable by
14 humans than a simple bytecount.
15
16 use Format::Human::Bytes;
17
18 $readable = Format::Human::Bytes::base2($bytecount[,$decimals]);
19 $readable = Format::Human::Bytes::base10($bytecount[,$decimals]);
20
21 $readable = Format::Human::Bytes->base2($bytecount[,$decimals]);
22 $readable = Format::Human::Bytes->base10($bytecount[,$decimals]);
23
24 my $fhb = Format::Human::Bytes->new();
25 $readable = $fhb->base2($bytecount[,$decimals]);
26 $readable = $fhb->base10($bytecount[,$decimals]);
27
29 new
30 my $fhb = Format::Human::Bytes->new();
31
32 Creates and returns a Format::Human::Bytes - object.
33
34 base2
35 Callable as a function:
36
37 $readable = Format::Human::Bytes::base2($bytecount[,$decimals]);
38
39 Callable as a class method:
40
41 $readable = Format::Human::Bytes->base2($bytecount[,$decimals]);
42
43 Callable as a object method:
44
45 $readable = $fhb->base2($bytecount[,$decimals]);
46
47 Returns the correct readable form of the given bytecount.
48
49 Correct in this case means that 1kB are 1024 Bytes which is how
50 computers see the world.
51
52 If you specify a decimal parameter, the result number will have the
53 number of decimal numbers you specified.
54
55 base10
56 Callable as a function:
57
58 $readable = Format::Human::Bytes::base10($bytecount[,$decimals]);
59
60 Callable as a class method:
61
62 $readable = Format::Human::Bytes->base10($bytecount[,$decimals]);
63
64 Callable as a object method:
65
66 $readable = $fhb->base10($bytecount[,$decimals]);
67
68 Returns the incorrect readable form of the given bytecount.
69
70 Incorrect in this case means that 1kB is 1000 Bytes and 1 MB is 1000000
71 bytes which is how some (many) people see the world, but it's wrong for
72 computers.
73
74 If you specify a decimal parameter, the result number will have the
75 number of decimal numbers you specified.
76
78 Sebastian Willing, "<sewi at cpan.org>"
79
81 Please report any bugs or feature requests to "bug-format-human-bytes
82 at rt.cpan.org", or through the web interface at
83 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Format-Human-Bytes
84 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Format-Human-Bytes>. I
85 will be notified, and then you'll automatically be notified of progress
86 on your bug as I make changes.
87
89 You can find documentation for this module with the perldoc command.
90
91 perldoc Format::Human::Bytes
92
93 You can also look for information at:
94
95 · RT: CPAN's request tracker
96
97 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Format-Human-Bytes
98 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Format-Human-Bytes>
99
100 · AnnoCPAN: Annotated CPAN documentation
101
102 http://annocpan.org/dist/Format-Human-Bytes
103 <http://annocpan.org/dist/Format-Human-Bytes>
104
105 · CPAN Ratings
106
107 http://cpanratings.perl.org/d/Format-Human-Bytes
108 <http://cpanratings.perl.org/d/Format-Human-Bytes>
109
110 · Search CPAN
111
112 http://search.cpan.org/dist/Format-Human-Bytes/
113 <http://search.cpan.org/dist/Format-Human-Bytes/>
114
117 Copyright 2009 Sebastian Willing, all rights reserved.
118
119 This program is released under the following license: gpl
120
121
122
123perl v5.12.0 2009-09-29 Format::Human::Bytes(3)