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              
3 2     2   874 use strict;
  2         3  
  2         50  
4 2     2   9 use warnings;
  2         3  
  2         67  
5              
6             our $VERSION = "0.016_001";
7              
8 2     2   9 use Moo::Role;
  2         3  
  2         12  
9              
10             =head1 NAME
11              
12             MooX::Cmd::Role::ConfigFromFile - MooX::ConfigFromFile support role for MooX::Cmd
13              
14             =cut
15              
16             requires "config_prefixes";
17              
18             around _build_config_prefixes => sub {
19             my $next = shift;
20             my $class = shift;
21             my $params = shift;
22             my $cfg_pfxs = $class->$next($params, @_);
23              
24             ref $params->{command_chain} eq "ARRAY"
25             and push @{$cfg_pfxs},
26             grep { defined $_ } map { $_->command_name } grep { $_->can("command_name") } @{$params->{command_chain}};
27              
28             return $cfg_pfxs;
29             };
30              
31             =head1 LICENSE AND COPYRIGHT
32              
33             Copyright 2015-2017 Jens Rehsack.
34              
35             This program is free software; you can redistribute it and/or modify it
36             under the terms of either: the GNU General Public License as published
37             by the Free Software Foundation; or the Artistic License.
38              
39             See L for more information.
40              
41             =cut
42              
43             1;