aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2017-07-29 03:31:47 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-07-25 02:16:37 +0200
commitc366fa9f7308b8e96e424f8f877d2fa768ee71b0 (patch)
treeab0f0fb7bece914f9705c7517bfceeab0ae26b4a /lib
parent0c50edd3b1a2ac017ab661de57f1e93a9a755016 (diff)
Add skip-not-found toggle to .read when called with (Str, Str, Bool)
Diffstat (limited to 'lib')
-rw-r--r--lib/Config.pm69
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Config.pm6 b/lib/Config.pm6
index 1a1deab..d0c1d93 100644
--- a/lib/Config.pm6
+++ b/lib/Config.pm6
@@ -124,11 +124,14 @@ class Config is Associative is export
#| Load a configuration file from the given path. Optionally
#| set a parser module name to use. If not set, Config will
#| attempt to deduce the parser to use.
- multi method read(Str $path, Str $parser = "")
- {
+ multi method read(
+ Str $path,
+ Str $parser = "",
+ Bool :$skip-not-found = False
+ ) {
Config::Exception::FileNotFoundException.new(
path => $path
- ).throw() unless $path.IO.f;
+ ).throw() unless ($path.IO.f || $skip-not-found);
$!parser = self.get-parser($path, $parser);