package Display::Plugins::MPD;
use Clutter;
+use Carp qw(cluck);
use Audio::MPD;
use POSIX qw/strftime/;
use POE::Session;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new(@_);
+ bless ($self, $class);
+
+ eval {
+ $self->{'mpd'} = Audio::MPD->new();
+ };
+ if ($@) {
+ carp "Failed to connect to MPD: $@";
+ } else {
+ $self->init_delay($delay, 'mpd_display');
+ $self->init();
+ }
- $self->{'mpd'} = Audio::MPD->new();
$self->{'file'} = '';
$self->{'active'} = 0;
- bless ($self, $class);
- $self->init_delay($delay, 'mpd_display');
- $self->init();
return $self;
}