File Coverage

blib/lib/Mnet/Dump.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 21 22 95.4


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   7 use warnings;
  1         3  
  1         31  
7 1     1   5 use strict;
  1         2  
  1         19  
8 1     1   5 use Mnet;
  1         1  
  1         15  
9 1     1   688 use Data::Dumper;
  1         6951  
  1         148  
10              
11              
12              
13             sub line {
14              
15             # $out = Mnet::Dump::line($val)
16             # purpose: returns single line sorted Data::Dumper output for input value
17             # $value: input variable to dump, can be a scalar, hash, array, reference, etc
18             # $out: output Data::Dumper line, examples: undef, "value", [ list ], { etc }
19              
20             # read input value, dump it as a sorted single Data::Dumper line
21 6     6 0 16 my $val = shift;
22 6         27 my $out = Data::Dumper->new([$val])->Indent(0)->Sortkeys(1)->Useqq(1)->Dump;
23 6         410 $out =~ s/(^\$VAR1 = |;\n*$)//g;
24 6         29 return $out;
25             }
26              
27              
28             # normal end of package
29             1;
30