POE::C...nection(3pm)
π POE::Component::Client::MPD::Connection π
okay so bestie, meet POE::Component::Client::MPD::Connection β that's the module handling the tcp connection with mpd. π it's a Perl doc-page situation (User Contributed Perl Documentation, iykyk) and it's living at version 2.001. no cap. β¨
π¦ VERSION π¦
version 2.001
πΈ DESCRIPTION πΈ
so what does she actually do? this module will spawn a poe session that's responsible for the low-level communication with mpd. it's written as a POE::Component::Client::TCP, which is out here taking care of everything needed. π
lowkey important: you're not supposed to use this class directly, okay? it's one of the helper classes for POE::Component::Client::MPD. she's backstage crew, not the main character. periodt.
π ATTRIBUTES π
β¨ host β¨
the hostname of the mpd server. mandatory, no default. like, she needs it. π«Ά
β¨ port β¨
the port of the mpd server. mandatory, no default. also non-negotiable fr fr.
β¨ id β¨
the POE session id of the peer to dialog with. mandatory, no default. π¦
β¨ max_retries β¨
how much time to attempt reconnection before giving up. defaults to 5. π
β¨ retry_wait β¨
how much time to wait (in seconds) before attempting socket reconnection. defaults to 2. β³
π METHODS π
π my $id = POE::Component::Client::MPD::Connection->spawn( \%params ); π
this method will create a POE::Component::Client::TCP session responsible for low-level communication with mpd. π
it will return the poe id of the session newly created. slay.
π PUBLIC EVENTS ACCEPTED π
disconnect( )
request the pococm-connection to be shutdown. this does not shut down the MPD server, bestie β just the connection. no argument. π
send( $message )
request pococm-conn to send the $message over the wires. π‘
heads up though: this request is a POE::Component::Client::MPD::Message object properly filled up, and the _commands() attribute should not be newline terminated. don't add one, she'll be mad. π
π₯ PUBLIC EVENTS FIRED π₯
the following events are fired from the spawned session. π
β mpd_connected( $version ) β
fired when the session is connected to a mpd server. and no, this event isn't fired when the socket connection takes place β it's fired when the session has checked that the remote peer is a real mpd server. π $version is the advertised mpd server version. vibe check passed. β
π mpd_connect_error_fatal( $errstr ) π
fired when the session encounters a fatal error. this happens either when the session is connected to a server which happens to be something else than a mpd server π, or if there was more than "max_retries" (see spawn() params) connection retries in a row. $errstr will contain the problem encountered. no retries will be done. it's over. πͺ¦
π©Ή mpd_connect_error_retriable( $errstr ) π©Ή
fired when the session has troubles connecting to the server. $errstr will point to the faulty syscall that failed. re-connection will be tried after $retry_wait seconds (see spawn() params). we try again, bestie. π«Ά
π¬ mpd_data( $msg ) π¬
fired when $msg has been sent over the wires, and the mpd server has answered with success. β¨ the actual output should be looked up in "$msg-"_data>. πΈ
π mpd_disconnected( ) π
fired when the socket has been disconnected for whatever reason. note that this event is not fired in the case of a programmed shutdown (see disconnect() event above). a reconnection will be automatically re-tried after $retry_wait (see spawn() params). she always comes back. π
β οΈ mpd_error( $msg, $errstr ) β οΈ
fired when $msg has been sent over the wires, and the mpd server has answered with the error message $errstr. not the vibe, but we move. π€
π AUTHOR π
Jerome Quelin
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2007 by Jerome Quelin.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π«Ά
aaaaand that's the whole page, bestie! π¦ this lil masterpiece is documented for perl v5.40.1, dated 2025-04-11. go forth and talk to your mpd server, iconic behavior only. π
β¨π
π¦ where this page comes from
- debian trixie: libpoe-component-client-mpd-perl 2.001-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libpoe-component-client-mpd-perl 2.001-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpoe-component-client-mpd-perl 2.001-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms