line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mnet::Dump; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# purpose: functions to Data::Dumper used internally by other Mnet modules |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# required modules |
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
8
|
1
|
|
|
1
|
|
648
|
use Data::Dumper; |
|
1
|
|
|
|
|
7093
|
|
|
1
|
|
|
|
|
164
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub line { |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# $line = Mnet::Dump::line($value) |
15
|
|
|
|
|
|
|
# purpose: returns single line sorted Data::Dumper output for input value |
16
|
|
|
|
|
|
|
# $value: input variable to dump, can be a scalar, hash, array, reference, etc |
17
|
|
|
|
|
|
|
# $line: output Data::Dumper line, examples: undef, "value", [ list ], { etc } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# read input value, dump it as a sorted single Data::Dumper line |
20
|
6
|
|
|
6
|
0
|
13
|
my $value = shift; |
21
|
6
|
|
|
|
|
28
|
my $value_dumper = Data::Dumper->new([$value]); |
22
|
6
|
|
|
|
|
206
|
$value_dumper->Indent(0); |
23
|
6
|
|
|
|
|
81
|
$value_dumper->Sortkeys(1); |
24
|
6
|
|
|
|
|
38
|
$value_dumper->Useqq(1); |
25
|
6
|
|
|
|
|
31
|
my $value_dump = $value_dumper->Dump; |
26
|
6
|
|
|
|
|
137
|
$value_dump =~ s/(^\$VAR1 = |;\n*$)//g; |
27
|
6
|
|
|
|
|
54
|
return $value_dump; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# normal end of package |
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|