diff options
author | Patrick Spek <p.spek@tyil.nl> | 2017-07-29 03:31:47 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2017-07-29 03:31:47 +0200 |
commit | cc0fcb245bf87fbf518260db591d139ff218d9af (patch) | |
tree | ab0f0fb7bece914f9705c7517bfceeab0ae26b4a /lib/Config.pm6 | |
parent | 7c4249285fb09530fb149659ffadb45ac948d602 (diff) |
Add skip-not-found toggle to .read when called with (Str, Str, Bool)v1.2.1
Diffstat (limited to 'lib/Config.pm6')
-rw-r--r-- | lib/Config.pm6 | 9 |
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); |