File Coverage

blib/lib/Data/Printer/Filter/REF.pm
Criterion Covered Total %
statement 19 20 95.0
branch 3 4 75.0
condition 6 9 66.6
subroutine 5 5 100.0
pod 0 1 0.0
total 33 39 84.6


line stmt bran cond sub pod time code
1             package Data::Printer::Filter::REF;
2 34     34   261 use strict;
  34         75  
  34         1018  
3 34     34   175 use warnings;
  34         72  
  34         800  
4 34     34   179 use Data::Printer::Filter;
  34         85  
  34         222  
5 34     34   212 use Scalar::Util ();
  34         76  
  34         5907  
6              
7             filter 'REF' => \&parse;
8              
9             sub parse {
10 65     65 0 142 my ($ref, $ddp) = @_;
11              
12 65         113 my $string = '';
13             # we only add the '\' if it's not an object
14 65 100 66     511 if (!Scalar::Util::blessed($$ref) && (ref $$ref eq 'REF' || ref $$ref eq 'SCALAR' || ref $$ref eq 'VSTRING')) {
      66        
15 24         53 $string .= '\\ ';
16             }
17 65         253 $string .= $ddp->parse($$ref);
18              
19 65 50 66     199 if ($ddp->show_tied and my $tie = ref tied $ref) {
20 0         0 $string .= " (tied to $tie)";
21             }
22              
23 65         236 return $string;
24             };
25              
26             1;