in reply to Re^3: Dynamically wrapping ancestor method calls
in thread Dynamically wrapping ancestor method calls
Out of interest, may I ask about the the original problem which is being addressed by the automagic wrappering?
I'm the author of Audio::XMMSClient. This module provides an asynchronous interface th xmms2's client library. This is quite powerful but not very easy to use, especially very simple scripts or unit tests which don't need the async interface most of the time.
Therefor I wanted to write a wrapper, Audio::XMMSClient::Sync, around it that does just the same as Audio::XMMSClient does on all method calls, except for those which return some kind of request handle to be used in asynchronous clients. In that case it should just block until the request is completed, unpack the response into some perl structure and return that.
That way code that looked like that with the async api..
my $con = Audio::XMMSClient->new(...); $con->connect or die $con->last_error; my $res = $con->medialib_get_info( $some_song ); $res->wait; my $value = $res->value;
becomes that..
my $con = Audio::XMMSClient::Sync->new(...); $con->connect or die $con->last_error; my $value = $con->medialib_get_info( $some_song );
Cheers, Flo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Dynamically wrapping ancestor method calls
by jbert (Priest) on Dec 11, 2006 at 21:37 UTC | |
by rafl (Friar) on Dec 12, 2006 at 23:37 UTC |