Sign in to PrePAN



GitHub: jjatria PAUSE ID: JJATRIA

User's Modules

AnyEvent::Net::MPD A non-blocking interface for MPD

This is a module to asynchronously talk to an MPD server.

There are a number of MPD libraries on CPAN, but all of them are either blocking (eg. Audio::MPD, Net::MPD) or plugins that depend on a larger framework (eg. POE::Component::Client::MPD, Dancer::Plugin::MPD). Of these, Audio::MPD seems unmaintained, and the POE component depends on Audio::MPD as well.

Net::MPD states an asynchronous interface in its feature wishlist, but it hasn't seen any updates in about a year. An empty repository for Net::MPD::Async exists on the author's Github page, so it doesn't seem like any work has been done on that front.

That was the motivation to write this one.

Apart from a review of the code itself, I would be grateful for any comments on the namespace. I wouldn't want to put this under either Audio::MPD or Net::MPD, since the interface of this module is not like any of those, so it's not really in the same family. For the time being, I chose to go with AnyEvent::Net::MPD since the AnyEvent::Net namespace already seems to have other libraries for the purpose of talking to specific networked services.

There are some example scripts in the t/examples folder.

All comments are most welcome.

jjatria@github 0 comments

MojoX::Log::Any Use the current Log::Any adapter from Mojolicious

MojoX::Log::Any makes it easy to use a Log::Any::Adapter from within Mojolicious without getting in the way of the user.

When imported from within a Mojolicious application (of from within a package into which Mojolicious' app function has been exported), it sets that application's log attribute to a Log::Any::Proxy connected to whatever adapter is currently available.

When imported, the logger defaults to using Log::Any::Adapter::MojoLog, which seems to be the currently maintained adapter for Mojo::Log. Any parameters passed to the module's import function are passed as is to the get_logger function from Log::Any, to allow for user customisation and to maintain a coherent interface with that package.


There are numerous packages in the MojoX::Log namespace providing an interface with the various different logging mechanisms on CPAN; except Log::Any.

There is also a Log::Any adapter for Mojo::Log, which makes it possible to use that logger from any application using Log::Any; but not Mojolicious apps.

This package attempts to fill that void by offering Mojolicious applications an easy way to plug into the current Log::Any::Adapter (whatever it may be).

jjatria@github 0 comments