From afef60893ef8310b745e4adb7d3e6e8dfee47463 Mon Sep 17 00:00:00 2001 From: mischa Date: Fri, 3 Jul 2020 12:58:07 +0200 Subject: [PATCH] move map -> grep, little bit better on the eyes --- huectl.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/huectl.pl b/huectl.pl index 9301417..1bf846b 100755 --- a/huectl.pl +++ b/huectl.pl @@ -67,7 +67,8 @@ END_USAGE my ($bridgename) = @ARGV; if (!$bridgename) { _return_error_with($USAGE); } -my @config_files = map { -e $_ ? $_ : () } ('./hue.conf', './.hue.conf', '/etc/hue.conf', "$ENV{'HOME'}/.hue.conf", "$ENV{'HOME'}/hue.conf"); +#my @config_files = map { -e $_ ? $_ : () } ('./hue.conf', './.hue.conf', '/etc/hue.conf', "$ENV{'HOME'}/.hue.conf", "$ENV{'HOME'}/hue.conf"); +my @config_files = grep { -e } ('./hue.conf', './.hue.conf', '/etc/hue.conf', "$ENV{'HOME'}/.hue.conf", "$ENV{'HOME'}/hue.conf"); my $config = Config::Tiny->read($config_files[-1], 'utf8'); my $bridge = $config->{$bridgename}{ip} || _return_error_with("$USAGE\nError: bridge-name '$bridgename' not found.\n"); my $token = $config->{$bridgename}{token};