AnyEvent-FCP

 view release on metacpan or  search on metacpan

FCP.pm  view on Meta::CPAN


The following methods implement various requests. Most of them map
directory to the FCP message of the same name. The added benefit of
these over sending requests yourself is that they handle the necessary
serialisation, protocol quirks, and replies.

All of them exist in two versions, the variant shown in this manpage, and
a variant with an extra C<_> at the end, and an extra C<$cb> argument. The
version as shown is I<synchronous> - it will wait for any replies, and
either return the reply, or croak with an error. The underscore variant
returns immediately and invokes one or more callbacks or condvars later.

For example, the call

   $info = $fcp->get_plugin_info ($name, $detailed);

Also comes in this underscore variant:

   $fcp->get_plugin_info_ ($name, $detailed, $cb);

You can thinbk of the underscore as a kind of continuation indicator - the

FCP.pm  view on Meta::CPAN

   },

=item A condvar (as returned by e.g. C<< AnyEvent->condvar >>)

When a condvar is passed, it is sent (C<< $cv->send ($results) >>) the
results when the request has finished. Should an error occur, the error
will instead result in C<< $cv->croak ($error) >>.

This is also a popular choice.

=item An array with two callbacks C<[$success, $failure]>

The C<$success> callback will be invoked with the results, while the
C<$failure> callback will be invoked on any errors.

The C<$failure> callback will be invoked with the error object from the
server.

=item C<undef>

This is the same thing as specifying C<sub { }> as callback, i.e. on

README  view on Meta::CPAN

  FCP REQUESTS
    The following methods implement various requests. Most of them map
    directory to the FCP message of the same name. The added benefit of
    these over sending requests yourself is that they handle the necessary
    serialisation, protocol quirks, and replies.

    All of them exist in two versions, the variant shown in this manpage,
    and a variant with an extra "_" at the end, and an extra $cb argument.
    The version as shown is *synchronous* - it will wait for any replies,
    and either return the reply, or croak with an error. The underscore
    variant returns immediately and invokes one or more callbacks or
    condvars later.

    For example, the call

       $info = $fcp->get_plugin_info ($name, $detailed);

    Also comes in this underscore variant:

       $fcp->get_plugin_info_ ($name, $detailed, $cb);

README  view on Meta::CPAN

              exit 1;
           },

    A condvar (as returned by e.g. "AnyEvent->condvar")
        When a condvar is passed, it is sent ("$cv->send ($results)") the
        results when the request has finished. Should an error occur, the
        error will instead result in "$cv->croak ($error)".

        This is also a popular choice.

    An array with two callbacks "[$success, $failure]"
        The $success callback will be invoked with the results, while the
        $failure callback will be invoked on any errors.

        The $failure callback will be invoked with the error object from the
        server.

    "undef"
        This is the same thing as specifying "sub { }" as callback, i.e. on
        success, the results are ignored, while on failure, the "on_failure"
        hook is invoked or the module dies with a backtrace.



( run in 0.549 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )