From c7e3736d35527593235ae12bf6e879689ea17f66 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 23 Jul 2015 20:12:38 +0200 Subject: Add a command-line option --config to specify the configuration file. --- lib/Net/IMAP/Sync.pm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm index 0228f29..61930e7 100644 --- a/lib/Net/IMAP/Sync.pm +++ b/lib/Net/IMAP/Sync.pm @@ -65,6 +65,9 @@ sub read_config($$%) { my $section = shift; my %opts = (%OPTIONS, @_); + $conffile = ($ENV{XDG_CONFIG_HOME} // "$ENV{HOME}/.config") .'/'. $conffile + unless $conffile =~ /\A\//; # relative path + die "No such config file $conffile\n" unless defined $conffile and -f $conffile and -r $conffile; -- cgit v1.2.3