Subject: | Incorrectly Setting Audio::MPD object's conntype |
In the code for Dancer::Plugin::MPD, you are trying to set the conntype
attribute of the underlying Audio::MPD object to 'reuse' but you never
actually set it.
sub _connect {
my $conf = plugin_setting;
# Only pass settings to Audio::MPD if they're specified in the
config;
# Audio::MPD does sensible things by default, so in the majority of
cases
# (MPD listening on localhost, on port 6600, with no password set),
no
# configuration will be needed at all.
my %mpd_conf;
for my $setting (qw(host port password)) {
$mpd_conf{$setting} = $conf->{$setting} if exists $conf->
{$setting};
}
# Audio::MPD's default conntype is 'once', which re-establishes a
connection
# for every request. For performance, we probably want to re-use a
# connection.
$conf->{conntype} ||= 'reuse';
return Audio::MPD->new(\%mpd_conf);
}
Would better be:
In the code for Dancer::Plugin::MPD, you are trying to set the conntype
attribute of the underlying Audio::MPD object to 'reuse' but you never
actually set it.
sub _connect {
my $conf = plugin_setting;
# Only pass settings to Audio::MPD if they're specified in the
config;
# Audio::MPD does sensible things by default, so in the majority of
cases
# (MPD listening on localhost, on port 6600, with no password set),
no
# configuration will be needed at all.
my %mpd_conf;
for my $setting (qw(host port password conntype)) {
$mpd_conf{$setting} = $conf->{$setting} if exists $conf->
{$setting};
}
# Audio::MPD's default conntype is 'once', which re-establishes a
connection
# for every request. For performance, we probably want to re-use a
# connection.
$mpd_conf{conntype} ||= 'reuse';
return Audio::MPD->new(\%mpd_conf);
}
This allows the conntype setting to be overridden and changes the
default to reuse.