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   6 use warnings;
  1         1  
  1         26  
7 1     1   5 use strict;
  1         1  
  1         14  
8 1     1   4 use Mnet;
  1         1  
  1         24  
9 1     1   501 use Data::Dumper;
  1         5815  
  1         129  
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 12 my $val = shift;
22 6         25 my $out = Data::Dumper->new([$val])->Indent(0)->Sortkeys(1)->Useqq(1)->Dump;
23 6         345 $out =~ s/(^\$VAR1 = |;\n*$)//g;
24 6         22 return $out;
25             }
26              
27              
28             # normal end of package
29             1;
30