commit afef60893ef8310b745e4adb7d3e6e8dfee47463 from: mischa date: Fri Jul 03 10:58:07 2020 UTC move map -> grep, little bit better on the eyes commit - b4743f94c2696958ef088d468f68ddab64c1b8f9 commit + afef60893ef8310b745e4adb7d3e6e8dfee47463 blob - 93014170b06b59b69d2ae611eb3a1e911bcf9efc blob + 1bf846be38a4db77832f736976b884fa9bb7865f --- huectl.pl +++ 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};