aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2017-07-29 02:01:27 +0200
committerPatrick Spek <p.spek@tyil.nl>2017-07-29 02:01:27 +0200
commit1b638f16bd34f757fe2e1bcaf0cfa4a2f75c79f7 (patch)
tree2f3b191748327d02efa04602290624dc84dc489c
parentbe3c386df7015fece6c6823017642e792a19fe0e (diff)
Make the read method return False if no files were loaded
-rw-r--r--lib/Config.pm611
1 files changed, 8 insertions, 3 deletions
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.