line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::human_byte_size; |
2
|
2
|
|
|
2
|
|
993
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
108048
|
|
|
2
|
|
|
|
|
12
|
|
3
|
2
|
|
|
2
|
|
400
|
use Moo; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
4
|
2
|
|
|
2
|
|
828
|
use Catmandu::Fix::Has; |
|
2
|
|
|
|
|
626
|
|
|
2
|
|
|
|
|
12
|
|
5
|
2
|
|
|
2
|
|
1055
|
use Catmandu::Util qw(); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
146
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Catmandu::Fix::SimpleGetValue'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub emit_value { |
12
|
1
|
|
|
1
|
0
|
6612
|
my ($self, $var) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
6
|
"${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
|
|
|
|
|
|
|
add_field('size',1024) |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#size converted to '1KB' |
26
|
|
|
|
|
|
|
human_byte_size('size') |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 AUTHOR |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Nicolas Franck, C<< <nicolas.franck at ugent.be> >> |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SEE ALSO |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
L<Catmandu::Fix> |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |