File Coverage

blib/lib/Dancer2/Plugin/FormValidator/Factory/Extensions.pm
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 32 33 96.9


line stmt bran cond sub pod time code
1              
2             use strict;
3 10     10   66 use warnings;
  10         20  
  10         271  
4 10     10   45  
  10         20  
  10         233  
5             use Moo;
6 10     10   46 use Module::Load qw(autoload);
  10         21  
  10         140  
7 10     10   3577 use Types::Standard qw(InstanceOf HashRef);
  10         944  
  10         82  
8 10     10   669 use namespace::clean;
  10         20  
  10         72  
9 10     10   8742  
  10         19  
  10         122  
10             has plugin => (
11             is => 'ro',
12             isa => InstanceOf['Dancer2::Plugin::FormValidator'],
13             );
14              
15             has extensions => (
16             is => 'ro',
17             isa => HashRef,
18             );
19              
20             my ($self) = @_;
21              
22 10     10 0 33 my @extensions = map {
23             my $extension = $self->extensions->{$_}->{provider};
24             autoload $extension;
25 1         5  
26 1         9 $extension->new(
27             plugin => $self->plugin,
28             config => $self->extensions->{$_},
29             );
30 1         96 } keys %{ $self->extensions };
31              
32 10         22 return \@extensions;
  10         63  
33             }
34 10         1741  
35             1;