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 32     32   192 use strict;
  32         51  
  32         807  
3 32     32   160 use warnings;
  32         52  
  32         650  
4 32     32   146 use Data::Printer::Filter;
  32         56  
  32         176  
5 32     32   179 use Scalar::Util ();
  32         78  
  32         4765  
6              
7             filter 'REF' => \&parse;
8              
9             sub parse {
10 65     65 0 135 my ($ref, $ddp) = @_;
11              
12 65         110 my $string = '';
13             # we only add the '\' if it's not an object
14 65 100 66     568 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     178 if ($ddp->show_tied and my $tie = ref tied $ref) {
20 0         0 $string .= " (tied to $tie)";
21             }
22              
23 65         215 return $string;
24             };
25              
26             1;