die() instead of silently skip files with extensions we can't handle
[catagits/Catalyst-Plugin-ConfigLoader.git] / lib / Catalyst / Plugin / ConfigLoader.pm
index 930d7c1..04ac7e3 100644 (file)
@@ -26,6 +26,15 @@ Catalyst::Plugin::ConfigLoader - Load config files of various types
     # you can specify a file if you'd like
     __PACKAGE__->config( 'Plugin::ConfigLoader' => { file => 'config.yaml' } );    
 
+  In the file, assuming it's in YAML format:
+
+    foo: bar
+
+  Accessible through the context object, or the class itself
+
+   $c->config->{foo}    # bar
+   MyApp->config->{foo} # bar
+
 =head1 DESCRIPTION
 
 This module will attempt to load find and load a configuration
@@ -58,7 +67,6 @@ sub setup {
                 || {},
         }
     );
-
     # map the array of hashrefs to a simple hash
     my %configs = map { %$_ } @$cfg;
 
@@ -118,14 +126,14 @@ sub find_files {
 
     my @files;
     if ( $extension ) {
-        next unless grep { $_ eq $extension } @extensions;
+        die "Unable to handle files with the extension '${extension}'"
+            unless grep { $_ eq $extension } @extensions;
         ( my $local = $path ) =~ s{\.$extension}{_$suffix.$extension};
         push @files, $path, $local;
     }
     else {
         @files = map { ( "$path.$_", "${path}_${suffix}.$_" ) } @extensions;
     }
-
     @files;
 }