line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::human_byte_size; |
2
|
2
|
|
|
2
|
|
921
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
107422
|
|
|
2
|
|
|
|
|
28
|
|
3
|
2
|
|
|
2
|
|
419
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
4
|
2
|
|
|
2
|
|
813
|
use Catmandu::Fix::Has; |
|
2
|
|
|
|
|
630
|
|
|
2
|
|
|
|
|
11
|
|
5
|
2
|
|
|
2
|
|
976
|
use Catmandu::Util qw(); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
156
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Catmandu::Fix::SimpleGetValue'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub emit_value { |
12
|
1
|
|
|
1
|
0
|
6073
|
my ($self, $var) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
4
|
"${var} = Catmandu::Util::human_byte_size(${var}) if is_string( ${var} );"; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Catmandu::Fix::human_byte_size - convert from size in bytes to human readable form |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#size in bytes |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
add_field('size',1024) |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#size converted to '1KB' |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
human_byte_size('size') |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 AUTHOR |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Nicolas Franck, C<< <nicolas.franck at ugent.be> >> |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SEE ALSO |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
L<Catmandu::Fix> |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |