From 1b638f16bd34f757fe2e1bcaf0cfa4a2f75c79f7 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sat, 29 Jul 2017 02:01:27 +0200 Subject: Make the read method return False if no files were loaded --- lib/Config.pm6 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/Config.pm6 b/lib/Config.pm6 index ad350bf..61cc3a1 100644 --- a/lib/Config.pm6 +++ b/lib/Config.pm6 @@ -142,20 +142,25 @@ class Config is export return True; } - #| Read a list of paths. Will fail on the first file that - #| fails to load for whatever reason. + #| Read a list of paths. Will fail on the first file that fails to load for + #| whatever reason. If no files could be loaded, the method will return + #| False. multi method read( List $paths, Str $parser = "", Bool :$skip-not-found = False ) { + my bool $read = False; + for $paths.list -> $path { next if $skip-not-found && !$path.IO.f; self.read($path, $parser); + + $read = True; } - return True; + return $read; } #| Read a plain Hash into the configuration. -- cgit v1.1