From cc0fcb245bf87fbf518260db591d139ff218d9af Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Sat, 29 Jul 2017 03:31:47 +0200
Subject: Add skip-not-found toggle to .read when called with (Str, Str, Bool)
---
lib/Config.pm6 | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'lib')
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);
--
cgit v1.1