move map -> grep, little bit better on the eyes

This commit is contained in:
mischa 2020-07-03 12:58:07 +02:00
parent b4743f94c2
commit afef60893e
1 changed files with 2 additions and 1 deletions

View File

@ -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};