File Coverage

lib/AnyEvent/Connection/Util.pm
Criterion Covered Total %
statement 16 27 59.2
branch 2 6 33.3
condition n/a
subroutine 4 6 66.6
pod 0 1 0.0
total 22 40 55.0


line stmt bran cond sub pod time code
1             package #hide
2             AnyEvent::Connection::Util;
3              
4 2     2   13 use common::sense 2;m{
  2         58  
  2         19  
5             use strict;
6             use warnings;
7             };
8 2     2   133 use Carp;
  2         14  
  2         541  
9              
10             sub import {
11 4     4   10 my $me = shift;
12 4         10 my $pk = caller;
13 4 50       18 for (@_ ? @_ : qw(dumper)) {
14 4 50       20 defined &$_ or croak "$_ is not exported by $me";
15 4         9 *{$pk.'::'.$_} = \&$_;
  4         33  
16             }
17 4         4392 return;
18             }
19              
20             sub dumper (@) {
21 0 0   0 0   eval { require Data::Dumper;1 } or return @_;
  0            
  0            
22 2     2   12 no strict 'refs';
  2         4  
  2         468  
23 0           *{ caller().'::dumper' } = sub (@) {
24 0     0     my $s = Data::Dumper->new([@_])
25             #->Maxdepth(3)
26             ->Terse(1)
27             ->Indent(1)
28             ->Purity(0)
29             ->Useqq(1)
30             ->Quotekeys(0)
31             ->Dump;
32 0           $s =~ s{\\x\{([a-f0-9]{1,4})\}}{chr hex $1}sge;
  0            
33 0           $s;
34 0           };
35 0           goto &{ caller().'::dumper' };
  0            
36             }
37              
38             1;