Skip Menu |

This queue is for tickets about the Dancer-Plugin-MPD CPAN distribution.

Report information
The Basics
Id: 68753
Status: resolved
Priority: 0/
Queue: Dancer-Plugin-MPD

People
Owner: Nobody in particular
Requestors: aberndt [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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.
On 2011-06-10 19:15:15, ABERNDT wrote: Show quoted text
> 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.
Ah, you're absolutely right. That was a somewhat silly mistake, wasn't it? :) Thanks for taking the time to report it and to provide a fix. I've just released 0.02 with this fix (and with some documentation on configuration, which was also missing). Thanks!