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
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
8
|
1
|
|
|
1
|
|
593
|
use Data::Dumper; |
|
1
|
|
|
|
|
5864
|
|
|
1
|
|
|
|
|
135
|
|
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
|
10
|
my $value = shift; |
21
|
6
|
|
|
|
|
23
|
my $value_dumper = Data::Dumper->new([$value]); |
22
|
6
|
|
|
|
|
143
|
$value_dumper->Indent(0); |
23
|
6
|
|
|
|
|
65
|
$value_dumper->Sortkeys(1); |
24
|
6
|
|
|
|
|
32
|
$value_dumper->Useqq(1); |
25
|
6
|
|
|
|
|
29
|
my $value_dump = $value_dumper->Dump; |
26
|
6
|
|
|
|
|
102
|
$value_dump =~ s/(^\$VAR1 = |;\n*$)//g; |
27
|
6
|
|
|
|
|
42
|
return $value_dump; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# normal end of package |
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|