File Coverage

blib/lib/MooX/Cmd/Role/ConfigFromFile.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package MooX::Cmd::Role::ConfigFromFile;
2             # ABSTRACT: MooX::ConfigFromFile support role for MooX::Cmd
3             our $VERSION = '1.000';
4 2     2   2070 use strict;
  2         7  
  2         123  
5 2     2   14 use warnings;
  2         4  
  2         158  
6              
7 2     2   13 use Moo::Role;
  2         4  
  2         20  
8              
9              
10             requires "config_prefixes";
11              
12             around _build_config_prefixes => sub {
13             my $next = shift;
14             my $class = shift;
15             my $params = shift;
16             my $cfg_pfxs = $class->$next($params, @_);
17              
18             ref $params->{command_chain} eq "ARRAY"
19             and push @{$cfg_pfxs},
20             grep { defined $_ } map { $_->command_name } grep { $_->can("command_name") } @{$params->{command_chain}};
21              
22             return $cfg_pfxs;
23             };
24              
25             1;
26              
27             __END__