Audio-XMMSClient
view release on metacpan or search on metacpan
pm/XMMSClient/Result.pod view on Meta::CPAN
Restart a signal.
A lot of signals you would like to get notified about when they change, instead
of polling the server all the time. These results are "restartable".
sub handler {
my ($result) = @_;
if ($result->iserror) {
warn "error: ", $result->get_error;
return;
}
my $id = $result->value;
$result->restart;
print "current id is: ${id}\n";
}
# connect, blah, blah, ...
my $res = $conn->signal_playback_playtime;
$res->notifier_set(\&handler);
In the above example the handler would be called when the playtime is updated.
Only signals are restatable. Broadcasts will automaticly restart.
=cut
=head2 notifier_set
=over 4
=item Arguments: \&func, $data?
=item Return Value: none
=back
$result->notifier_set(sub { die 'got an answer!' });
Set up a callback for the result retrival. This callback will be called when
the answers arrives. It's arguments will be the result itself as well as an
optional userdata if C<$data> is passed.
=cut
=head2 wait
=over 4
=item Arguments: none
=item Return Value: $result
=back
my $value = $result->wait->value;
Block for the reply. In a synchronous application this can be used to wait for
the result. Will return the C<$result> this method was called when the server
replyed.
=cut
=head2 source_preference_set
=over 4
=item Arguments: @preferences
=item Return Value: none
=back
$result->source_preference_set(qw{plugin/* plugin/id3v2 client/* server});
Set source C<@preferences> to be used when fetching stuff from a propdict.
=cut
=head2 get_type
=over 4
=item Arguments: none
=item Return Value: $type
=back
my $type = $result->get_type;
Get the type of the result. May be one of "none", "uint", "int", "dict", "bin",
"coll", "list" or "propdict".
=cut
=head2 iserror
=over 4
=item Arguments: none
=item Return Value: 1 | 0
=back
my $has_error = $result->iserror;
Check if the result represents an error. Returns a true value if the result is
an error, false otherwise.
=cut
=head2 get_error
( run in 0.934 second using v1.01-cache-2.11-cpan-e1769b4cff6 )