From 19f112c912c826a86ed96fc5b519397fea40991c Mon Sep 17 00:00:00 2001 From: Eric Wilde Date: Mon, 12 Nov 2018 23:20:45 +1300 Subject: [PATCH] Make Config::Auto an optional module. --- bin/mythtv-status | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/mythtv-status b/bin/mythtv-status index 754eb38..10aff76 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -26,20 +26,22 @@ use POSIX qw/strftime :sys_wait_h/; use MIME::Entity; use Pod::Usage; -use Config::Auto; use Sys::SigAction qw/timeout_call/; use Encode; # Try and load a config file first, and then allow the command line -# to over ride what is in the config file. -my $c = eval { - Config::Auto::parse("mythtv-status.yml", - format => 'yaml', - ) -}; -if ($@ && $@ !~ /^No config file found/) { - # Die on any issues loading the config file, apart from it not existing. - die $@; +# to override what is in the config file. +my ($c); + +if (eval("{ local \$SIG{__DIE__}; require Config::Auto; }")) { + $c = eval { + Config::Auto::parse("mythtv-status.yml", format => 'yaml') + }; + + if ($@ && $@ !~ /^No config file found/) { + # Die on any issues loading the config file, apart from it not existing. + die $@; + } } # Some sane defaults. -- 2.30.2