summaryrefslogtreecommitdiffstats
path: root/lib/App/ArchLinux/PackagerTools
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/ArchLinux/PackagerTools')
-rw-r--r--lib/App/ArchLinux/PackagerTools/Config.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/App/ArchLinux/PackagerTools/Config.pm b/lib/App/ArchLinux/PackagerTools/Config.pm
index a58e82d..531e517 100644
--- a/lib/App/ArchLinux/PackagerTools/Config.pm
+++ b/lib/App/ArchLinux/PackagerTools/Config.pm
@@ -42,6 +42,7 @@ method new_no_defaults($class: $context, $deps = {}) {
my $self = {};
bless $self, $class;
$self->{deps} = $deps;
+ $self->{config} = $self->_load_config();
$context->{$class} = $self;
return $self;
}
@@ -59,8 +60,24 @@ Return config content as a hash.
=cut
method get_config() {
- my $config = $self->_get_default_config();
+ return $self->{config};
+}
+
+=head2 Private Methods
+
+=cut
+
+=head3 _load_config
+ my $conf = $config->_load_config();
+
+Load configuration from config file. You should use get_config() instead since
+that returns a cached in-memory copy.
+
+=cut
+
+method _load_config() {
+ my $config = $self->_get_default_config();
my $file = path(($ENV{XDG_CONFIG_HOME} // $ENV{HOME}."/.config")."/perlpkg/config.toml");
if ($file->exists) {
$log->debugf("Reading config file: %s", $file);