File Coverage

blib/lib/DB/Pluggable/Plugin/DataPrinter.pm
Criterion Covered Total %
statement 17 26 65.3
branch 0 6 0.0
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 24 40 60.0


line stmt bran cond sub pod time code
1             package DB::Pluggable::Plugin::DataPrinter;
2 1     1   496 use strict;
  1         2  
  1         34  
3 1     1   5 use warnings;
  1         3  
  1         21  
4 1     1   15 use 5.010;
  1         3  
5 1     1   4 use Role::Basic;
  1         2  
  1         5  
6 1     1   590 use Data::Printer; # to make it a requirement
  1         31096  
  1         7  
7             with qw(DB::Pluggable::Role::Initializer);
8             our $VERSION = '1.12';
9              
10             sub initialize {
11 0     0 1   my ($self) = @_;
12 1     1   580 no warnings 'once';
  1         3  
  1         156  
13 0           my @options;
14 0           for my $opt (keys %{ $self }) {
  0            
15 0 0         next if $opt eq 'name';
16 0 0         next if ref( $self->{ $opt } );
17 0           push @options, "$opt => $self->{ $opt }";
18             }
19              
20 0 0         my $options = @options ? ', ' . join( ', ', @options ) : '';
21 0           $DB::alias{p} = "s/^(.*)\$/Data::Printer::\$1$options/";
22             }
23             1;
24              
25             __END__