Hello,

I am working with POE::Component::Client::MPD for the first time and attempting to get the example provided working. I have modified it along the way but results have been the same (code is below).

The MPD (Music Player Daemon) logging shows the client connect and disconnect (when I control-c). However, none of the events I send get to the daemon (also running on localhost with default port). I added print statements at pretty much all the entry points for events within MPD.pm and none of them get hit. Therefore maybe this is not a problem with MPD.pm but my usage of POE.

Also note that I can use the command line client that comes with MPD to interact with the daemon and that works as expected as well as it generates logging information.

Which direction should I go in to track it down?

Thanks,

John

#!/usr/bin/env/perl #

use warnings;
use strict;

use FindBin qw{ $Bin };
use lib "$Bin/../lib";

use POE;
use POE::Component::Client::MPD;

POE::Component::Client::MPD->spawn( {
    alias          => 'mpd',
    } );

POE::Session->create(
    inline_states => {
        _start     => \&start,
        _stop      => sub { print "bye-bye\n"; },
        mpd_result => \&result,
        mpd_error => \&error,
        status_msgs_to => \&clutter,
    }
);
POE::Kernel->run;
exit;


sub start {
    my $k = $_[KERNEL];
$k->alias_set('client'); # increment refcount
    print "hello there\n";
    $k->post( 'mpd' => 'current' );
    $k->post( 'mpd', 'coll:all_files' );
    print "done with start\n";

}

sub result {
    print "yeah!\n";
}

sub error {
    print "got an error\n";
}

sub clutter {
    print "got some clutter!\n";

}

Reply via email to