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   40 use File::Find;
  5         13  
  5         1252  
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 28 my $path = shift;
11              
12 8         25 my @config_files = ();
13             find(
14             sub {
15 55     55   156 my $file_name = $File::Find::name;
16 55 100       128 push @config_files, $file_name
17             if is_config_file($file_name);
18             },
19 8         702 @$path
20             );
21              
22 8         73 return @config_files;
23             }
24              
25             sub is_config_file {
26 55     55 0 113 my $file_name = shift;
27              
28             # Must be a file
29 55 100       1183 return 0 unless -f $file_name;
30              
31             # Must have a specific name
32 45 100       569 return 0 if index( $file_name, '/moosex-dic-wiring.yml' ) == -1;
33              
34 3         29 return 1;
35             }
36              
37              
38             1;