From: Damyan Ivanov Date: Thu, 18 Nov 2021 06:14:09 +0000 (+0000) Subject: no warnings on undef usage when idle waiting results in no changes X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=0135556249d5b1a2296dbb3a46eaba31fa9230a0;p=mpd-feeder.git no warnings on undef usage when idle waiting results in no changes this is normal when the idle mode is stopped with 'noidle' --- diff --git a/lib/App/MPD/Feeder.pm b/lib/App/MPD/Feeder.pm index ed5d276..7da421a 100644 --- a/lib/App/MPD/Feeder.pm +++ b/lib/App/MPD/Feeder.pm @@ -237,14 +237,22 @@ use constant DEFAULT_CONFIG_FILE => '/etc/mpd-feeder/mpd-feeder.conf'; sub { my $result = shift; - if ( $result->{changed} eq 'database' ) { + undef $idler; + + my $changed = $result->{changed} // ''; + + if ( $changed eq 'database' ) { $db_needs_update = 1; $self->prepare_to_wait_idle; } - elsif ( $result->{changed} eq 'playlist' ) { + elsif ( $changed eq 'playlist' ) { $self->queue_songs( undef, sub { $self->prepare_to_wait_idle } ); } + elsif ( $changed eq '' ) { + $log->debug("got no changes from idle"); + $self->prepare_to_wait_idle; + } else { use JSON; $log->warn(