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 35     35   300 use strict;
  35         75  
  35         1118  
3 35     35   183 use warnings;
  35         69  
  35         860  
4 35     35   207 use Data::Printer::Filter;
  35         82  
  35         206  
5 35     35   176 use Scalar::Util ();
  35         72  
  35         6165  
6              
7             filter 'REF' => \&parse;
8              
9             sub parse {
10 65     65 0 153 my ($ref, $ddp) = @_;
11              
12 65         120 my $string = '';
13             # we only add the '\' if it's not an object
14 65 100 66     460 if (!Scalar::Util::blessed($$ref) && (ref $$ref eq 'REF' || ref $$ref eq 'SCALAR' || ref $$ref eq 'VSTRING')) {
      66        
15 24         51 $string .= '\\ ';
16             }
17 65         280 $string .= $ddp->parse($$ref);
18              
19 65 50 66     205 if ($ddp->show_tied and my $tie = ref tied $ref) {
20 0         0 $string .= " (tied to $tie)";
21             }
22              
23 65         249 return $string;
24             };
25              
26             1;