Result:
found more than 837 distributions - search limited to the first 2001 files matching your query ( run in 0.448 )


AnyEvent-MPRPC

 view release on metacpan or  search on metacpan

lib/AnyEvent/MPRPC/Client.pm  view on Meta::CPAN

        my $id = 0;
        sub { ++$id };
    },
);

has _callbacks => (
    is      => 'ro',
    isa     => 'HashRef',
    lazy    => 1,
    default => sub { +{} },
);

lib/AnyEvent/MPRPC/Client.pm  view on Meta::CPAN

    else {
        push @{ $self->_request_pool }, $request;
    }

    # $msgid is stringified, but $request->{MP_RES_MSGID] is still IV
    $self->_callbacks->{ $msgid } = AnyEvent->condvar;
}

sub _handle_response_cb {
    my $self = shift;

lib/AnyEvent/MPRPC/Client.pm  view on Meta::CPAN

    return sub {
        $self || return;

        my ($handle, $res) = @_;

        my $d = delete $self->_callbacks->{ $res->[MP_RES_MSGID] };

        if (my $error = $res->[MP_RES_ERROR]) {
            if ($d) {
                $d->croak($error);
            } else {

 view all matches for this distribution


AnyEvent-MPV

 view release on metacpan or  search on metacpan

MPV.pm  view on Meta::CPAN


Most of the complicated parts deal with saving and restoring per-video
data, such as bookmarks, playing position, selected audio and subtitle
tracks and so on. However, since it uses L<Coro>, it can conveniently
block and wait for replies, which is n ot possible in purely event based
programs, as you are not allowed to block inside event callbacks in most
event loops. This simplifies the code quite a bit.

When the file to be played is a Tv recording done by mythtv, it uses the
C<appending> protocol and deinterlacing:

MPV.pm  view on Meta::CPAN


After this, C<Gtk2::CV> waits for the file to be loaded, video to be
configured, and then queries the video size (to resize its own window)
and video format (to decide whether an audio visualizer is needed for
audio playback). The problematic word here is "wait", as this needs to be
imploemented using callbacks.

This made the code much harder to write, as the whole setup is very
asynchronous (C<Gtk2::CV> talks to the command interface in F<mpv>, which
talks to the decode and playback parts, all of which run asynchronously
w.r.t. each other. In practise, this can mean that C<Gtk2::CV> waits for
a file to be loaded by F<mpv> while the command interface of F<mpv> still
deals with the previous file and the decoder still handles an even older
file). Adding to this fact is that Gtk2::CV is bound by the glib event
loop, which means we cannot wait for replies form F<mpv> anywhere, so
everything has to be chained callbacks.

The way this is handled is by creating a new empty hash ref that is unique
for each loaded file, and use it to detect whether the event is old or
not, and also store C<AnyEvent::MPV> guard objects in it:

 view all matches for this distribution


AnyEvent-MQTT

 view release on metacpan or  search on metacpan

lib/AnyEvent/MQTT.pm  view on Meta::CPAN

  for the topic to unsubscribe from (this is required),

=item B<callback>

  for the callback to call with messages (this is optional and currently
  not supported - all callbacks are unsubscribed),

=item B<cv>

  L<AnyEvent> condvar to use to signal the unsubscription is complete.

 view all matches for this distribution


AnyEvent-MSN

 view release on metacpan or  search on metacpan

lib/AnyEvent/MSN.pm  view on Meta::CPAN

                 clearer => '_reset_contacts',
                 writer  => '_set_contacts',
                 traits  => ['Hash'],
);

# Simple callbacks
has 'on_' . $_ => (
    traits  => ['Code'],
    is      => 'ro',
    isa     => 'CodeRef',
    default => sub {

 view all matches for this distribution


AnyEvent-Mattermost

 view release on metacpan or  search on metacpan

lib/AnyEvent/Mattermost.pm  view on Meta::CPAN

=head2 new

    $mconn = AnyEvent::Mattermost->new( $host, $team, $email, $password );

Creates a new AnyEvent::Mattermost object. No connections are opened and no
callbacks are registered yet.

The C<$host> parameter must be the HTTP/HTTPS URL of your Mattermost server. If
you omit the scheme and provide only a hostname, HTTPS will be assumed. Note
that Mattermost servers configured over HTTP will also use unencrypted C<ws://>
for the persistent WebSockets connection for receiving incoming messages. You

lib/AnyEvent/Mattermost.pm  view on Meta::CPAN


Closes connection with Mattermost server and ceases processing messages.
Callbacks which have been registered are left in place in case you wish to
start() the connection again.

If you wish to remove callbacks, without disposing of the AnyEvent::Mattermost
object itself, you will need to call on() and pass C<undef> for each events'
callback value (rather than the anonymous subroutines you had provided when
registering them).

=cut

lib/AnyEvent/Mattermost.pm  view on Meta::CPAN


    $mconn->on( $event1 => sub {}, [ $event2 => sub {}, ... ] );

Registers a callback for the named event type. Multiple events may be registered
in a single call to on(), but only one callback may exist for any given event
type. Any subsequent callbacks registered to an existing event handler will
overwrite the previous callback.

Every callback will receive two arguments: the AnyEvent::Mattermost object and
the raw message data received over the Mattermost WebSockets connection. This
message payload will take different forms depending on the type of event which

lib/AnyEvent/Mattermost.pm  view on Meta::CPAN

reference containing the payload of the event. For channel messages this will
include things like the sender's name, the channel name and type, and of course
the message itself.

For more explanation of event types, hope that the Mattermost project documents
them at some point. For now, L<Data::Dumper> based callbacks are your best bet.

=cut

sub on {
    my ($self, %registrations) = @_;

 view all matches for this distribution


AnyEvent-Net-Curl-Queued

 view release on metacpan or  search on metacpan

lib/AnyEvent/Net/Curl/Queued.pm  view on Meta::CPAN

L<AnyEvent>: the L<DBI> of event loops. L<Net::Curl> also provides a nice and well-documented example of L<AnyEvent> usage (L<03-multi-event.pl|Net::Curl::examples/Multi::Event>).

=back

L<AnyEvent::Net::Curl::Queued> is a glue module to wrap it all together.
It offers no callbacks and (almost) no default handlers.
It's up to you to extend the base class L<AnyEvent::Net::Curl::Queued::Easy> so it will actually download something and store it somewhere.

=head2 ALTERNATIVES

As there's more than one way to do it, I'll list the alternatives which can be used to implement batch downloads:

 view all matches for this distribution


AnyEvent-OWNet

 view release on metacpan or  search on metacpan

lib/AnyEvent/OWNet.pm  view on Meta::CPAN


The supplied callback is called for each device with the path to each
device as the first argument and the condvar for the operation as the
second argument.  The intention of passing the callback the condvar
(that if not provided is created by the initial call) is to enable the
callbacks that need to make further asynchronous calls to use C<begin>
calls and C<end> calls (in the async callback) on the condvar so that
the complete operation may be tracked.  See the L</SYNOPSIS> for an
example.

This method currently assumes that the C<owserver> supports the C<getslash>

 view all matches for this distribution


AnyEvent-Open3-Simple

 view release on metacpan or  search on metacpan

lib/AnyEvent/Open3/Simple.pm  view on Meta::CPAN

usage.  Note the modules listed in the SEE ALSO section below for other
interfaces that may be more or less appropriate.

=head1 CONSTRUCTOR

Constructor takes a hash or hashref of event callbacks and attributes.
Event callbacks have an C<on_> prefix, attributes do not.

=head2 ATTRIBUTES

=over 4

lib/AnyEvent/Open3/Simple.pm  view on Meta::CPAN

     my($proc) = @_;
     $proc->user({ iteration => $i });
   });
 }

This is useful for making data accessible to C<$ipc> object's callbacks that may
be out of scope otherwise.

=head1 CAVEATS

Some AnyEvent implementations may not work properly with the method

lib/AnyEvent/Open3/Simple.pm  view on Meta::CPAN

=over 4

=item L<AnyEvent::Open3::Simple::Process>

Represents a process being run by this module, typically passed
into the callbacks.

=item L<AnyEvent::Subprocess>

Alternative to this module.

 view all matches for this distribution


AnyEvent-Pg-Pool-Multiserver

 view release on metacpan or  search on metacpan

example/ex.pl  view on Meta::CPAN


$cv->recv;

$cv = AE::cv;

# multi-server request with sub-callbacks to some data manipulation
# and may be to make another request to current server

# main request | server_1 select -> ... select end -> cb_server call -> subrequests to current server | wait both   | global callback
#              | server_2 select -> ... select end -> cb_server call -> subrequests to current server | subrequests |

 view all matches for this distribution


AnyEvent-Pg

 view release on metacpan or  search on metacpan

lib/AnyEvent/Pg.pm  view on Meta::CPAN


=item on_result => sub { ... }

=item on_done => sub { ... }

These callbacks perform in the same fashion as on the C<push_query>
method.

=back

=item $w = $adb->push_query_prepared(%opts)

lib/AnyEvent/Pg.pm  view on Meta::CPAN


=item on_done => sub { ... }

=item on_error => sub { ... }

These callbacks work as on the C<push_query> method.

=back

=item $w = $adb->unshift_query(%opts)

lib/AnyEvent/Pg.pm  view on Meta::CPAN

several queries.

=item $adb->abort_all

Marks the connection as dead and aborts any queued queries calling the
C<on_error> callbacks.

=item $adb->queue_size

Returns the number of queries queued for execution.

 view all matches for this distribution


AnyEvent-Porttracker

 view release on metacpan or  search on metacpan

Porttracker.pm  view on Meta::CPAN


The L<AnyEvent::TLS> object to use. See C<tls>, above.

=item on_XYZ => $coderef

You can specify event callbacks either by sub-classing and overriding the
respective methods or by specifying code-refs as key-value pairs when
constructing the object. You add or remove event handlers at any time with
the C<event> method.

=back

Porttracker.pm  view on Meta::CPAN

      my ($api, $msg) = @_;
      warn $msg;
      exit 1;
   }

Event callbacks are not expected to return anything and are always passed
the API object as first argument. Some might have default implementations
(for example, C<on_error>), others are ignored unless overriden.

Description of individual events follow:

 view all matches for this distribution


AnyEvent-Process

 view release on metacpan or  search on metacpan

lib/AnyEvent/Process.pm  view on Meta::CPAN

	AE::postpone { $cv_yield->send };
	$cv_yield->recv;
}

# Create a callback factory. This is needed to execute on_completion after all
# other callbacks. 
sub _create_callback_factory {
	my $on_completion = shift // $nop;
	my $counter = 0;
	my @on_completion_args;

lib/AnyEvent/Process.pm  view on Meta::CPAN

				$hdl->$method(@{$call->[1]});
			}
			$job->_add_handle($hdl);
		}

		# Create callbacks
		my $completion_cb = sub {
			$job->_remove_timers();
			AE::log info => "Process $job->{pid} finished with code $_[1].";
			$set_on_completion_args->($job, $_[1]);
		};

lib/AnyEvent/Process.pm  view on Meta::CPAN


Callback, which is executed when the process finishes. It receives 
AnyEvent::Process::Job instance as the first argument and exit code as the 
second argument.

It is called after all AnyEvent::Handle callbacks specified in the fh_table.

=item watchdog_interval (in seconds, optional)

How often a watchdog shall be called. If undefined or set to 0, the watchdog
functionality is disabled. 

 view all matches for this distribution


AnyEvent-Promise

 view release on metacpan or  search on metacpan

lib/AnyEvent/Promise.pm  view on Meta::CPAN

    })->fulfill;

=head1 DESCRIPTION

L<AnyEvent::Promise> allows evented interfaces to be chained, taking away some
of the redundancy of layering L<AnyEvent> condition variable callbacks.

A promise is created using L<AnyEvent::Promise::new|/new> or the exported
L</promise> helper function. These will both return a promise instance and add
the callback function as the start of the promise chain. Each call to L</then>
on the promise instance will add another subroutine which returns a condition

lib/AnyEvent/Promise.pm  view on Meta::CPAN

called on the instance. Calling L</condvar> or L</cv> will start the callback
chain and return the promise guarding condvar, which is fulfilled after the last
callback on the chain returns. Similarily, L</fulfill> will start the chain, but
will block until the guarding condvar is fulfilled.

Errors in the callbacks can be caught by setting an exception handler via the
L</catch> method on the promise instance. This method will catch exceptions
raised from L<AnyEvent> objects and exceptions raised in blocks provided to
L</then>. If an error is encountered in the chain, an exception will be thrown
and the rest of the chain will be skipped, jumping straight to the catch
callback.

lib/AnyEvent/Promise.pm  view on Meta::CPAN

}

=head2 catch($cb)

Catch raised errors in the callback chain. Exceptions in the promise chain will
jump up to this catch callback, bypassing any other callbacks in the promise
chain. The error caught by L<Try::Tiny> will be sent as arguments to the
callback C<$cb>.

=cut
sub catch {

 view all matches for this distribution


AnyEvent-RabbitMQ-Fork

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.6       2020-07-26 14:02:30-04:00 America/New_York
    - fix operator typo in _generate_callback
    - redundant code cleanup
    - simplify logic in _generate_callback
    - make ::Channel->delegate private
    - safer rpc callbacks with weakened self
    - update test suite from AnyEent::RabbitMQ with mods to get it working again

0.5       2014-12-28 17:38:10-05:00 America/New_York
    - update test suite to align with AnyEvent::RabbitMQ
    - support bind_exchange & unbind_exchange methods
    - in Worker: generate stand-in callbacks in a separate method

0.4       2014-06-06 16:43:00-04:00 America/New_York
    - improve handling object state attirbutes being reported to parent

0.3       2014-06-05 08:49:21-04:00 America/New_York

 view all matches for this distribution


AnyEvent-RabbitMQ-RPC

 view release on metacpan or  search on metacpan

lib/AnyEvent/RabbitMQ/RPC.pm  view on Meta::CPAN

=head2 call name => C<STRING>, args => C<VALUE>

Submits a job to the job queue.  The C<VALUE> provided must be a string,
unless C<serialize> was passed to L</new>.

Three callbacks exist:

=over

=item on_reply

 view all matches for this distribution


AnyEvent-RabbitMQ-Simple

 view release on metacpan or  search on metacpan

lib/AnyEvent/RabbitMQ/Simple.pm  view on Meta::CPAN


=head1 DESCRIPTION

This module is meant to simplify the process of setting up the RabbitMQ channel,
so you can start publishing and/or consuming messages without chaining
C<on_success> callbacks.

=head1 METHODS

=head2 new

 view all matches for this distribution


AnyEvent-RabbitMQ

 view release on metacpan or  search on metacpan

lib/AnyEvent/RabbitMQ/Channel.pm  view on Meta::CPAN

    $frame ||= $self->_close_frame();

    return if $self->{_state} == _ST_CLOSED;
    $self->{_state} = _ST_CLOSED;

    # Perform callbacks for all outstanding commands
    $self->{_queue}->_flush($frame);
    $self->{_content_queue}->_flush($frame);

    # Fake nacks of all outstanding publishes
    $_->($frame) for grep { defined } map { $_->[1] } values %{ $self->{_publish_cbs} };

lib/AnyEvent/RabbitMQ/Channel.pm  view on Meta::CPAN

C<immediate> or C<mandatory> flags.

If in confirm mode, this callback will be called with the frame that reports message
return, typically L<Net::AMQP::Protocol::Basic::Return>.  If confirm mode is off or
this callback is not provided, then the channel or connection objects' on_return
callbacks (if any), will be called instead.

NOTE: If confirm mode is on, the on_ack or on_nack callback will be called whether or
not on_return is called first.

=back

 view all matches for this distribution


AnyEvent-Radius

 view release on metacpan or  search on metacpan

lib/AnyEvent/Radius/Client.pm  view on Meta::CPAN

#   dictionary
#   read_timeout
#   write_timeout
#   bind_ip
#   initial_last_request_id - random by default
#- callbacks:
#    on_read
#    on_read_raw
#    on_read_timeout
#    on_write_timeout
#    on_error

 view all matches for this distribution


AnyEvent-Redis-RipeRedis

 view release on metacpan or  search on metacpan

lib/AnyEvent/Redis/RipeRedis.pm  view on Meta::CPAN

The C<on_error> callback is called when some error occurred.

=item on_reply => $cb->( [ $reply ] [, $err_msg, $err_code ] )

Since version 1.300 of the client you can specify single, C<on_reply> callback,
instead of two, C<on_done> and C<on_error> callbacks. The C<on_reply> callback
is called in both cases: when operation was completed successfully or when some
error occurred. In first case to callback is passed only reply data. In second
case to callback is passed three arguments: The C<undef> value or reply data
with error objects (see below), error message and error code.

lib/AnyEvent/Redis/RipeRedis.pm  view on Meta::CPAN

=head1 DISCONNECTION

When the connection to the server is no longer needed you can close it in three
ways: call the method C<disconnect()>, send the C<QUIT> command or you can just
"forget" any references to an AnyEvent::Redis::RipeRedis object, but in this
case a client object is destroyed without calling any callbacks, including
the C<on_disconnect> callback, to avoid an unexpected behavior.

=head2 disconnect()

The method for synchronous disconnection. All uncompleted operations will be

 view all matches for this distribution


AnyEvent-Redis

 view release on metacpan or  search on metacpan

lib/AnyEvent/Redis.pm  view on Meta::CPAN

command.  Commands in between are not executed immediately when they're
sent.  On receipt of the "exec", the server executes all the saved commands
atomically, and returns all their results as one bulk reply.

After a transaction is finished, results for each individual command are
reported in the usual way.  Thus, by the time any of these callbacks is
called, the entire transaction is finished for better or worse.

Results of the "exec" (containing all the other results) will be returned as
an array reference containing all of the individual results.  This may in
some cases make callbacks on the individual commands unnecessary, or vice
versa.  In this bulk reply, errors reported for each individual command are
represented by objects of class C<AnyEvent::Redis::Error>, which will
respond to a C<< ->message >> method call with that error message.

It is not permitted to nest transactions.  This module does not permit

 view all matches for this distribution


AnyEvent-Retry

 view release on metacpan or  search on metacpan

lib/AnyEvent/Retry/Coro.pm  view on Meta::CPAN

    my $neat_gun = $r->run; # keep on trying until you run out of cake

=head1 DESCRIPTION

This module makes L<AnyEvent::Retry> work nicely with L<Coro>.  You
don't need to provide success or failure callbacks anymore, and your
task to retry just needs C<die> or return a result.

=head1 METHODS

=head2 run

 view all matches for this distribution


AnyEvent-RetryTimer

 view release on metacpan or  search on metacpan

lib/AnyEvent/RetryTimer.pm  view on Meta::CPAN


This is the constructor, it constructs the object.

At the end of the objects lifetime, when you get rid of the last reference to
C<$timer>, it will stop and running timeouts and not call any of the configured
callbacks again.

C<%args> can contain these keys:

=over 4

 view all matches for this distribution


AnyEvent-ReverseHTTP

 view release on metacpan or  search on metacpan

lib/AnyEvent/ReverseHTTP.pm  view on Meta::CPAN

  my $guard = reverse_http "myserver123", "token", sub {
      my $req = shift;
      return "Hello World"; # You can return HTTP::Response object for more control
  };

  # more controls over options and callbacks
  my $server = AnyEvent::ReverseHTTP->new(
      endpoint => "http://www.reversehttp.net/reversehttp",
      label    => "aedemo1234",
      token    => "mytoken",
  );

 view all matches for this distribution


AnyEvent-RipeRedis-Cluster

 view release on metacpan or  search on metacpan

lib/AnyEvent/RipeRedis/Cluster.pm  view on Meta::CPAN

=head1 DISCONNECTION

When the connection to the cluster is no longer needed you can close it in two
ways: call the method C<disconnect()> or just "forget" any references to an
AnyEvent::RipeRedis::Cluster object, but in this case the client object is
destroyed without calling any callbacks, including the C<on_disconnect>
callback, to avoid an unexpected behavior.

=head2 disconnect()

The method for disconnection. All uncompleted operations will be

 view all matches for this distribution


AnyEvent-RipeRedis

 view release on metacpan or  search on metacpan

lib/AnyEvent/RipeRedis.pm  view on Meta::CPAN


=head2 subscribe( @channels, ( $cb->( $msg, $channel ) | \%cbs ) )

Subscribes the client to the specified channels.

Method can accept two callbacks: C<on_reply> and C<on_message>. The C<on_reply>
callback is called when subscription to all specified channels will be
activated. In first argument to the callback is passed the number of channels
we are currently subscribed. If subscription to specified channels was lost,
the C<on_reply> callback is called with the error object in the second argument.

lib/AnyEvent/RipeRedis.pm  view on Meta::CPAN

=head1 DISCONNECTION

When the connection to the server is no longer needed you can close it in three
ways: call the method C<disconnect()>, send the C<QUIT> command or you can just
"forget" any references to an AnyEvent::RipeRedis object, but in this
case the client object is destroyed without calling any callbacks, including
the C<on_disconnect> callback, to avoid an unexpected behavior.

=head2 disconnect()

The method for synchronous disconnection. All uncompleted operations will be

 view all matches for this distribution


AnyEvent-SKKServ

 view release on metacpan or  search on metacpan

lib/AnyEvent/SKKServ.pm  view on Meta::CPAN


=item on_version => $cb->($handle) : CodeRef

=item on_host => $cb->($handle) : CodeRef

Takes callbacks corresponding to reply from the client (see L</PROTOCOL>).

=back

=head2 run

 view all matches for this distribution


AnyEvent-STOMP-Client

 view release on metacpan or  search on metacpan

lib/AnyEvent/STOMP/Client.pm  view on Meta::CPAN

}

sub destroy {
    my $self = shift;
    $self->disconnect(1) if $self->is_connected;
    $self->remove_all_callbacks;
}

sub DESTROY {
    my $self = shift;
    $self->disconnect(1) if $self->is_connected;

lib/AnyEvent/STOMP/Client.pm  view on Meta::CPAN

AnyEvent::STOMP::Client provides a STOMP (Simple Text Oriented Messaging
Protocol) client. Thanks to AnyEvent, AnyEvent::STOMP::Client is completely
non-blocking, by making extensive use of the AnyEvent::Handle and timers (and,
under the hood, AnyEvent::Socket). Building on Object::Event,
AnyEvent::STOMP::Client implements various events (e.g. the MESSAGE event, when
a STOMP MESSAGE frame is received) and offers callbacks for these (e.g.
on_message($callback)).

=head1 METHODS

=head2 $client = new $host, $port, $connect_headers, $tls_context

lib/AnyEvent/STOMP/Client.pm  view on Meta::CPAN


=back

=head2 $client->destroy

Disconnects and cleans up all callbacks. To be called when the client object
is not used any more and should be cleaned up.

=head2 Callbacks

In order for the C<AnyEvent::STOMP::Client> to be useful, callback subroutines

 view all matches for this distribution


AnyEvent-STOMP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - BUGFIX: Only unregister connect callback in error handler 
          if one was specified.  (Thanks to Dexter Tad-y for the fix.)

0.5     Thu Nov 11 16:55:38 PST 2010
        - Added support for 'prepare' and 'connect' events (same as
          on_prepare and on_connect callbacks in AnyEvent::Handle).

0.4     Thu Nov 11 14:40:00 PST 2010
        - Fixed a memory leak in the I/O error callback.
        - Fixed auto-acknowledge mode (only acknowledge messages having a 
          'message-id' header).

 view all matches for this distribution


AnyEvent-Stomper

 view release on metacpan or  search on metacpan

lib/AnyEvent/Stomper/Error.pm  view on Meta::CPAN

AnyEvent::Stomper::Error - Class of error for AnyEvent::Stomper

=head1 DESCRIPTION

Class of error for L<AnyEvent::Stomper>. Objects of this class can be passed
to callbacks.

=head1 CONSTRUCTOR

=head2 new( $err_msg, $err_code [, $frame ] )

 view all matches for this distribution


AnyEvent-Subprocess

 view release on metacpan or  search on metacpan

lib/AnyEvent/Subprocess/DefaultDelegates.pm  view on Meta::CPAN

});

register_delegate( 'MonitorHandle' => sub {
    my $args = shift || {};
    confess 'need handle' unless $args->{handle};
    confess 'need callbacks' unless $args->{callbacks} || $args->{callback};

    my $handle = $args->{handle};
    $args->{name} ||= $handle . '_monitor';

    $args->{callbacks} ||= $args->{callback};
    delete $args->{callback};

    return AnyEvent::Subprocess::Job::Delegate::MonitorHandle->new(%$args);
});

 view all matches for this distribution


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