File Coverage

lib/MooseX/DIC/Configuration/Scanner/FileConfig.pm
Criterion Covered Total %
statement 13 13 100.0
branch 6 6 100.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 23 25 92.0


line stmt bran cond sub pod time code
1             package MooseX::DIC::Configuration::Scanner::FileConfig;
2              
3 5     5   33 use File::Find;
  5         10  
  5         941  
4              
5             require Exporter;
6             @ISA = qw/Exporter/;
7             @EXPORT_OK = qw/fetch_config_files_from_path/;
8              
9             sub fetch_config_files_from_path {
10 8     8 0 25 my $path = shift;
11              
12 8         26 my @config_files = ();
13             find(
14             sub {
15 55     55   142 my $file_name = $File::Find::name;
16 55 100       113 push @config_files, $file_name
17             if is_config_file($file_name);
18             },
19 8         765 @$path
20             );
21              
22 8         64 return @config_files;
23             }
24              
25             sub is_config_file {
26 55     55 0 94 my $file_name = shift;
27              
28             # Must be a file
29 55 100       1292 return 0 unless -f $file_name;
30              
31             # Must have a specific name
32 45 100       477 return 0 if index( $file_name, '/moosex-dic-wiring.yml' ) == -1;
33              
34 3         21 return 1;
35             }
36              
37              
38             1;