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 4     4   25 use File::Find;
  4         8  
  4         669  
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 7     7 0 18 my $path = shift;
11              
12 7         17 my @config_files = ();
13             find(
14             sub {
15 48     48   94 my $file_name = $File::Find::name;
16 48 100       85 push @config_files, $file_name
17             if is_config_file($file_name);
18             },
19 7         598 @$path
20             );
21              
22 7         47 return @config_files;
23             }
24              
25             sub is_config_file {
26 48     48 0 66 my $file_name = shift;
27              
28             # Must be a file
29 48 100       871 return 0 unless -f $file_name;
30              
31             # Must have a specific name
32 39 100       384 return 0 if index( $file_name, '/moosex-dic-wiring.yml' ) == -1;
33              
34 3         17 return 1;
35             }
36              
37              
38             1;