- $mpd = Net::Async::MPD->new(
- host => $opt->mpd_host,
- port => $opt->mpd_port,
- auto_connect => 1,
- );
+ my %conn = ( auto_connect => 1 );
+ $conn{host} = $opt->mpd_host if $opt->mpd_host;
+ $conn{port} = $opt->mpd_port if $opt->mpd_port;
+
+ $mpd = Net::Async::MPD->new(%conn);