Component/Component/Plaggerize/PluginLoader.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 34 CC 3 SCAR 19.5
CC
3
Cov
0%
setup_config
12.0
setup_plugins
2.0
BEGIN
2.0
CRAP 7.0
1 package Class::Component::Component::Plaggerize::PluginLoader;
2 use strict;
3 use warnings;
4  
5 sub setup_config {
6 my $class = shift;
7 my $config = $class->NEXT( setup_config => @_ );
8  
9 $config->{global} = {} unless $config->{global};
10 $config->{global}->{pluginloader} = {} unless $config->{global}->{pluginloader};
11 my $conf = $config->{global}->{pluginloader};
12 $conf->{plugin_list} ||= 'plugins';
13  
14 $config;
15 }
16  
17 sub setup_plugins {
18 my $self = shift;
19  
20 my @plugins;
21 my $plugin_list = $self->conf->{global}->{pluginloader}->{plugin_list};
22 for my $plugin (@{ $self->conf->{$plugin_list} }) {
23 push @plugins, { module => $plugin->{module}, config => $plugin };
24 }
25 $self->load_plugins(@plugins);
26  
27 $self->NEXT( setup_plugins => @_ );
28 }
29  
30 1;