Version 0.09
[gitmo/MooseX-SimpleConfig.git] / lib / MooseX / SimpleConfig.pm
index 1a7add5..6122aea 100644 (file)
@@ -3,13 +3,14 @@ package MooseX::SimpleConfig;
 use Moose::Role;
 with 'MooseX::ConfigFromFile';
 
-our $VERSION   = '0.06';
+our $VERSION   = '0.09';
 
 use Config::Any ();
 
 sub get_config_from_file {
     my ($class, $file) = @_;
 
+    $file = $file->() if ref $file eq 'CODE';
     my $files_ref = ref $file eq 'ARRAY' ? $file : [$file];
 
     my $can_config_any_args = $class->can('config_any_args');
@@ -24,10 +25,11 @@ sub get_config_from_file {
     } );
 
     my %raw_config;
-    foreach my $file_tested ( @{$files_ref} ) {
+    foreach my $file_tested ( reverse @{$files_ref} ) {
         if ( ! exists $raw_cfany->{$file_tested} ) {
-            die qq{Specified configfile '$file_tested' does not exist, } .
-                q{is empty, or is not readable};
+            warn qq{Specified configfile '$file_tested' does not exist, } .
+                qq{is empty, or is not readable\n};
+                next;
         }
 
         my $cfany_hash = $raw_cfany->{$file_tested};