George S. Baugh hace 5 años
padre
commit
a58c829000
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      lib/Trog/Data/FlatFile.pm

+ 5 - 1
lib/Trog/Data/FlatFile.pm

@@ -40,7 +40,11 @@ sub read ($self, $query={}) {
     my @items;
     foreach my $item (@index) {
         next unless -f $item;
-        my $slurped = File::Slurper::read_text($item);
+        my $slurped = eval { File::Slurper::read_text($item) };
+        if (!$slurped) {
+            print "Failed to Read $item:\n$@\n";
+            next;
+        }
         my $parsed  = $parser->decode($slurped);
 
         #XXX this imposes an inefficiency in itself, get() will filter uselessly again here