File Coverage

blib/lib/DB/Pluggable/Plugin/TypeAhead.pm
Criterion Covered Total %
statement 17 24 70.8
branch 0 8 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::TypeAhead;
2 1     1   518 use strict;
  1         3  
  1         30  
3 1     1   5 use warnings;
  1         2  
  1         22  
4 1     1   15 use 5.010;
  1         4  
5 1     1   5 use Brickyard::Accessor rw => [qw(type ifenv)];
  1         2  
  1         6  
6 1     1   71 use Role::Basic;
  1         2  
  1         4  
7             with qw(DB::Pluggable::Role::AfterInit);
8             our $VERSION = '1.12';
9              
10             sub afterinit {
11 0     0 1   my $self = shift;
12 0           my $type = $self->type;
13 0 0         die "TypeAhead: need 'type' config key\n" unless defined $type;
14 0 0         die "TypeAhead: 'type' must be an array reference of things to type\n"
15             unless ref $type eq 'ARRAY';
16 0 0         if (my $env_key = $self->ifenv) {
17 0 0         return unless $ENV{$env_key};
18             }
19 1     1   151 no warnings 'once';
  1         2  
  1         81  
20 0           push @DB::typeahead, @$type;
21             }
22             1;
23              
24             __END__