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         2  
  1         33  
7 1     1   4 use strict;
  1         2  
  1         17  
8 1     1   4 use Mnet;
  1         2  
  1         16  
9 1     1   624 use Data::Dumper;
  1         7195  
  1         153  
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         24 my $out = Data::Dumper->new([$val])->Indent(0)->Sortkeys(1)->Useqq(1)->Dump;
23 6         430 $out =~ s/(^\$VAR1 = |;\n*$)//g;
24 6         27 return $out;
25             }
26              
27              
28             # normal end of package
29             1;
30