view release on metacpan or search on metacpan
lib/AnyEvent/Delay/Simple.pm view on Meta::CPAN
__END__
=head1 NAME
AnyEvent::Delay::Simple - Manage callbacks and control the flow of events by AnyEvent
=head1 SYNOPSIS
use AnyEvent::Delay::Simple;
lib/AnyEvent/Delay/Simple.pm view on Meta::CPAN
);
$cv->recv();
=head1 DESCRIPTION
AnyEvent::Delay::Simple manages callbacks and controls the flow of events for
AnyEvent. This module inspired by L<Mojo::IOLoop::Delay>.
=head1 FUNCTIONS
Both functions runs the chain of callbacks, the first callback will run right
away, and the next one once the previous callback finishes. This chain will
continue until there are no more callbacks, or an error occurs in a callback.
If an error occurs in one of the steps, the chain will be break, and error
handler will call, if it's defined. Unless error handler defined, error is
fatal. If last callback finishes and no error occurs, finish handler will call.
You may import these functions into L<AE> namespace instead of current one.
lib/AnyEvent/Delay/Simple.pm view on Meta::CPAN
delay($obj, \&cb_1, ..., \&cb_n, \&err, \&fin);
delay($obj, [\&cb_1, ..., \&cb_n], \&fin);
delay($obj, [\&cb_1, ..., \&cb_n], \&err, \&fin);
If the first argument is blessed reference then all callbacks will be calls as
the methods of this object.
Condvar and data from previous step passed as arguments to each callback or
finish handler. If an error occurs then condvar and error message passed to
the error handler. The data sends to the next step by using condvar's C<send()>
lib/AnyEvent/Delay/Simple.pm view on Meta::CPAN
easy_delay($obj, \&cb_1, ..., \&cb_n, \&err, \&fin);
easy_delay($obj, [\&cb_1, ..., \&cb_n], \&fin);
easy_delay($obj, [\&cb_1, ..., \&cb_n], \&err, \&fin);
This function is similar to the previous function. But its arguments contains
no condvar. And return values of each callbacks in chain passed as arguments to
the next one.
sub {
return ('foo', 'bar');
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/EC2/Tiny.pm view on Meta::CPAN
=head1 DESCRIPTION
This is a basic asynchronous, non-blocking, interface to EC2 based on
L<Net::EC2::Tiny>. It's relatively compatible while the only difference is
with regards to the callbacks and returned information.
=head1 METHODS
=head2 send
view all matches for this distribution
view release on metacpan or search on metacpan
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);
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
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/FDpasser.pm view on Meta::CPAN
=item $passer->push_recv_fh($cb->($fh))
In order to receive the filehandle, the receiving process calls C<push_recv_fh> and passes it a callback that will be called once one is available. The filehandle will be the first argument to this callback.
Note that you can add multiple callbacks with C<push_recv_fh> to the input queue between returning to the main loop. The callbacks will be invoked in the same order that the filehandles are received (which is the same order that they were sent).
This method is called C<push_recv_fh> instead of, say, C<recv_fh> to indicate that it is pushing a callback onto the end of a queue. Hopefully it should remind you of the similarly named C<push_read> method in L<AnyEvent::Handle>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/FIFO.pm view on Meta::CPAN
AnyEvent::FIFO - Simple FIFO Callback Dispatch
=head1 SYNOPSIS
my $fifo = AnyEvent::FIFO->new(
max_active => 1, # max "concurrent" callbacks to execute per slot
);
# send to the "default" slot
$fifo->push( \&callback, @args );
lib/AnyEvent/FIFO.pm view on Meta::CPAN
=head1 DESCRIPTION
AnyEvent::FIFO is a simple FIFO queue to dispatch events in order.
If you use regular watchers and register callbacks from various places in
your program, you're not necessarily guaranteed that the callbacks will be
executed in the order that you expect. By using this module, you can
register callbacks and they will be executed in that particular order.
=head1 METHODS
=head2 new
=over 4
=item max_active => $number
Number of concurrent callbacks to be executed B<per slot>.
=item cv => $cv
Instance of L<AnyEvent condvar|AnyEvent/"CONDITION VARIABLES">. AnyEvent::FIFO will create one for you if this is not provided.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/FTP/Role/Event.pm view on Meta::CPAN
=head1 DESCRIPTION
This role provides a uniform even callback mechanism for classes in L<AnyEvent::FTP>.
You declare events by using the C<define_events> method. Once declared
you can use C<on_>I<event_name> to add a callback to a particular event
and C<emit> to trigger those callbacks.
=head1 METHODS
=head2 define_events
__PACKAGE__->define_events( @list_of_event_names );
This is called within the class package to declare the event names for all
events used by the class. It creates methods of the form C<on_>I<event_name>
which can be used to add callbacks to events.
=head2 emit
$obj->emit($event_name, @arguments);
This calls the callbacks associated with the given C<$event_name>.
It will pass to that callback the given C<@arguments>.
=head1 SEE ALSO
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
FastPing.pm view on Meta::CPAN
=head1 THE AnyEvent::FastPing CLASS
The AnyEvent::FastPing class represents a single "pinger". A "pinger"
comes with its own thread to send packets in the background, a rate-limit
machinery and separate idle/receive callbacks.
The recommended workflow (there are others) is this: 1. create a new
AnyEvent::FastPing object 2. configure the address lists and ranges to
ping, also configure an idle callback and optionally a receive callback
3. C<start> the pinger.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Finger.pm view on Meta::CPAN
=head2 finger_server
my $server = finger_server $callback, \%options;
Start listening to finger callbacks and call the given callback
for each request. See L<AnyEvent::Finger::Server> for details
on the options and the callback.
=head1 CAVEATS
view all matches for this distribution
view release on metacpan or search on metacpan
=back
=head1 EXCEPTIONS
The same "policy" as with L<AnyEvent::Fork::RPC> applies - exceptions
will not be caught, and exceptions in both worker and in callbacks causes
undesirable or undefined behaviour.
=head1 SEE ALSO
L<AnyEvent::Fork>, to create the processes in the first place.
view all matches for this distribution
view release on metacpan or search on metacpan
to send an error message just before exiting, or when you want to ensure
replies timely reach the parent before starting a long blocking operation.
In these cases, you can call this function to flush any outstanding reply
data to the parent. This is done blockingly, so no requests will be
handled and no event callbacks will be called.
For example, you could wrap your request function in a C<eval> block and
report the exception string back to the caller just before exiting:
sub req {
view all matches for this distribution
view release on metacpan or search on metacpan
my $timeout; $timeout = AE::timer 1, 0 => sub { undef $timeout; $cv->send };
$cv->recv;
ok $dont_call_if_destroyed, "Don't touch callbacks if destroyed";
ok $timeout, "Timeout wasn't reached";
}
package FO_Test;
view all matches for this distribution
view release on metacpan or search on metacpan
It properly quotes your commands and parses the data structures returned
by GDB.
At the moment, it's in an early stage of development, so expect changes,
and, over time, further features (such as breakpoint-specific callbacks
and so on).
=head1 EXAMPLE PROGRAM
To get you started, here is an example program that runs F</bin/ls>,
Like C<cmd>, but blocks execution until the command has been executed, and
returns the results if sucessful. Croaks when GDB returns with an error.
This is purely a convenience method for small scripts: since it blocks
execution using a condvar, it is not suitable to be used inside callbacks
or modules.
That is, unless L<Coro> is used - with Coro, you can run multiple
C<cmd_sync> methods concurrently form multiple threads, with no issues.
Any callback specified as C<on_EVENTNAME> parameter to the constructor.
=back
You can change callbacks dynamically by simply replacing the corresponding
C<on_XXX> member in the C<$gdb> object:
$gdb->{on_event} = sub {
# new event handler
};
view all matches for this distribution
view release on metacpan or search on metacpan
argument is missing then C<localhost:2947> will be used.
If the connection cannot be established, then it will retry every
second. Otherwise, the connection is put into watcher mode.
You can specify various configuration parameters, most of them callbacks:
=over 4
=item host => $hostname
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Gearman/Client.pm view on Meta::CPAN
The namespace is currently implemented as a simple tab separated concatenation of the prefix and the function name.
=back
=head2 add_task($function, $workload, %callbacks)
Start new job and wait results in C<%callbacks>
$gearman->add_task(
$function => $workload,
on_complete => sub {
my $result = $_[1],
lib/AnyEvent/Gearman/Client.pm view on Meta::CPAN
},
);
C<$function> is a worker function name, and C<$workload> is a data that will be passed to worker.
C<%callbacks> is set of callbacks called by job events. Available callbacks are:
=over 4
=item on_complete => $cb->($self, $result)
lib/AnyEvent/Gearman/Client.pm view on Meta::CPAN
=back
You should to set C<on_complete> and C<on_fail> at least.
=head2 add_task_bg($function, $workload, %callbacks)
Starts a new background job. The parameters are the same as
L<add_task($function, $workload, %callbacks)|add_task()>, but the only
callback that is called is C<on_created>.
$gearman->add_task_bg(
$function => $workload,
on_created => sub {
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL
README
dist.ini
lib/AnyEvent/HTTP/LWP/UserAgent.pm
t/async.t
t/callbacks.t
t/invalid_host.t
t/main.t
t/release-pod-syntax.t
t/request_content_ref.t
t/response_content_cb.t
view all matches for this distribution
view release on metacpan or search on metacpan
- bump AnyEvent dependency version (reported by Richard Harris).
2.1 Thu Feb 24 13:11:51 CET 2011
- the keepalive and persistent parameters were actually named
differently in the code - they now work as documented.
- fix a bug where callbacks would sometimes never be called when
the request timeout is near or below the persistent connection
timeout (testcase by Cindy Wang).
- destroying the guard would have no effect when a request was
recursing or being retired.
view all matches for this distribution
view release on metacpan or search on metacpan
benchmark.pl view on Meta::CPAN
#starting requests
for ( 1 .. $concurency ) {
add_request( $_, $url );
}
$cv->recv; # begin receiving message and make callbacks magic ;)
end_bench(); # call the end
#subs
sub parse_command_line {
if (not defined @ARGV)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/HTTPD/ExtDirect.pm view on Meta::CPAN
sub run {
my ($self) = @_;
my $config = $self->config;
$self->set_callbacks(
api_path => $config->api_path,
router_path => $config->router_path,
poll_path => $config->poll_path,
);
lib/AnyEvent/HTTPD/ExtDirect.pm view on Meta::CPAN
$self->stop_request;
}
### PUBLIC INSTANCE METHOD ###
#
# Register the callbacks for Ext.Direct handlers.
# This effectively "primes" the server but does not make it
# enter a blocking wait.
#
sub set_callbacks {
my ($self, %arg) = @_;
my $config = $self->config;
my $api_path = $arg{api_path} || $config->api_path;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/HTTPD/Router.pm view on Meta::CPAN
This module aims to add as little as possible overhead to it while still being
flexible and extendable. It requires the same little dependencies that
L<AnyEvent::HTTPD> uses.
The dispatching for the routes happens first. If no route could be found, or you
do not stop further dispatching with C<stop_request()> the registered callbacks
will be executed as well; as if you would use L<AnyEvent::HTTPD>. In other
words, if you plan to use routes in your project you can use this module and
upgrade from callbacks to routes step by step.
Routes support http methods, but custom methods
L<https://cloud.google.com/apis/design/custom_methods> can also be used. You
don't need to, of course ;-)
lib/AnyEvent/HTTPD/Router.pm view on Meta::CPAN
=item * no_route_found => $request
When the dispatcher can not find a route that matches on your request, the
event C<no_route_found> will be emitted.
In the case that routes and callbacks (C<reg_cb()>) for paths as used with
C<AnyEvent::HTTPD> are mixed, keep in mind that that C<no_route_found> will
happen before the other path callbacks are executed. So for a
C<404 not found> handler you could do
$httpd->reg_cb('' => sub {
my ( $httpd, $req ) = @_;
$req->respond( [ 404, 'not found', {}, '' ] );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/HTTPD.pm view on Meta::CPAN
The L<AnyEvent::HTTPD> class inherits directly from
L<AnyEvent::HTTPD::HTTPServer> which inherits the event callback interface from
L<Object::Event>.
Event callbacks can be registered via the L<Object::Event> API (see the
documentation of L<Object::Event> for details).
For a list of available events see below in the I<EVENTS> section.
=over 4
lib/AnyEvent/HTTPD.pm view on Meta::CPAN
=item allowed_methods => $arrayref
This parameter sets the allowed HTTP methods for requests, defaulting to GET,
HEAD and POST. Each request received is matched against this list, and a
'501 not implemented' is returned if no match is found. Requests using
disallowed handlers will never trigger callbacks.
=back
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Handle/UDP.pm view on Meta::CPAN
=head2 wtimeout
If non-zero, then these enables an "inactivity" timeout: whenever this many seconds pass without a successful read or write on the underlying file handle (or a call to C<timeout_reset>), the on_timeout callback will be invoked (and if that one is mis...
There are three variants of the timeouts that work independently of each other, for both read and write (triggered when nothing was read OR written), just read (triggered when nothing was read), and just write: timeout, rtimeout and wtimeout, with co...
Note that timeout processing is active even when you do not have any outstanding read or write requests: If you plan to keep the connection idle then you should disable the timeout temporarily or ignore the timeout in the corresponding on_timeout cal...
Calling C<clear_timeout> (or setting it to zero, which does the same) disables the corresponding timeout.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Handle/Writer.pm view on Meta::CPAN
$hdl->push_sendfile('/path/to/file', 1024);
=head1 RATIONALE
We have great l<AnyEvent::Handle>. But it have only raw write queue. This module extends it with
callbacks in write queue and adds a C<push_sendfile()> call, which would be processed at correct time
=head1 METHODS
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/I3.pm view on Meta::CPAN
on_error => sub {
my ($hdl, $fatal, $msg) = @_;
delete $self->{ipchdl};
$hdl->destroy;
my $cb = $self->{callbacks};
# Trigger all one-time callbacks with undef
for my $type (keys %{$cb}) {
next if ($type & $event_mask) == $event_mask;
$cb->{$type}->();
delete $cb->{$type};
}
lib/AnyEvent/I3.pm view on Meta::CPAN
}
sub _handle_i3_message {
my ($self, $type, $payload) = @_;
return unless defined($self->{callbacks}->{$type});
my $cb = $self->{callbacks}->{$type};
$cb->(decode_json $payload);
return if ($type & $event_mask) == $event_mask;
# If this was a one-time callback, we delete it
# (when connection is lost, all one-time callbacks get triggered)
delete $self->{callbacks}->{$type};
}
=head2 $i3->subscribe(\%callbacks)
Subscribes to the given event types. This function awaits a hashref with the
key being the name of the event and the value being a callback.
my %callbacks = (
workspace => sub { say "Workspaces changed" }
);
if ($i3->subscribe(\%callbacks)->recv->{success}) {
say "Successfully subscribed";
}
The special callback with name C<_error> is called when the connection to i3
is killed (because of a crash, exit or restart of i3 most likely). You can
use it to print an appropriate message and exit cleanly or to try to reconnect.
my %callbacks = (
_error => sub {
my ($msg) = @_;
say "I am sorry. I am so sorry: $msg";
exit 1;
}
);
$i3->subscribe(\%callbacks)->recv;
=cut
sub subscribe {
my ($self, $callbacks) = @_;
# Register callbacks for each message type
for my $key (keys %{$callbacks}) {
if (!exists $events{$key}) {
warn "Could not subscribe to event type '$key'." .
" Supported events are " . join(" ", sort keys %events), $/;
next;
}
my $type = $events{$key};
$self->{callbacks}->{$type} = $callbacks->{$key};
}
$self->message(TYPE_SUBSCRIBE, [ keys %{$callbacks} ])
}
=head2 $i3->message($type, $content)
Sends a message of the specified C<type> to i3, possibly containing the data
lib/AnyEvent/I3.pm view on Meta::CPAN
my $cv = AnyEvent->condvar;
# We donât preserve the old callback as it makes no sense to
# have a callback on message reply types (only on events)
$self->{callbacks}->{$type} =
sub {
my ($reply) = @_;
$cv->send($reply);
undef $self->{callbacks}->{$type};
};
$cv
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-simple.t view on Meta::CPAN
client => sub {
my $port = shift;
my $cv = AE::cv();
my $cv_join = AE::cv();
my @callbacks = (
# sub {
# my ($channel, $raw) = @_;
# my $who = $raw->{prefix} || '*';
# my $channel_name = $raw->{params}->[0];
# my $msg = $raw->{params}->[1];
t/01-simple.t view on Meta::CPAN
'irc_privmsg' => sub {
# use Data::Dumper; warn Dumper($_[1]);
},
'publicmsg' => sub {
my ($irc, $channel, $raw) = @_;
my $cb = shift @callbacks;
$cb->($channel, $raw);
if (scalar(@callbacks) == 0) {
$cv->send();
}
},
'join' => sub {
ok 1, 'join event';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/IRC/Client.pm view on Meta::CPAN
IRC command.
If C<$coderef> was given and is a code reference, it will called each time a
C<$ctcp_command> is received, this is useful for eg. CTCP PING reply
generation. The arguments will be the same arguments that the C<ctcp> event
callbacks get. (See also C<ctcp> event description above). The return value of
the called subroutine should be a list of arguments for C<encode_ctcp>.
Currently you can only configure one auto-reply per C<$ctcp_command>.
Example:
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
offset => 3,
# downsample result to another database, retention policy and measurement
into => 'otherdb."default".cpu_load_per5m',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to select data: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
duration => '7d',
shard_duration => '30m',
replication => 3,
name => 'oneweek',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to create database: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
q => "DROP DATABASE mydb",
# or query created from arguments
database => "mydb",
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop database: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
where => q{host = 'server02'},
# multiple measurements can also be specified
measurements => [qw( cpu_load cpu_temp )],
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop measurement: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
# or query created from arguments
measurement => 'cpu_load',
where => q{host = 'server02' AND time < '2016-01-01'},
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop measurement: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
q => "DROP MEASUREMENT cpu_load",
# or query created from arguments
measurement => 'cpu_load',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop measurement: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
q => "DROP SHARD 1",
# or query created from arguments
id => 1,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop measurement: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
$cv = AE::cv;
$db->kill_query(
id => 36,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to kill query: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
duration => '1d',
shard_duration => '168h',
replication => 1,
default => 0,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to create retention policy: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
duration => '1d',
shard_duration => '12h',
replication => 1,
default => 1,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to alter retention policy: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
# or query created from arguments
name => "last_day",
database => "mydb",
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop retention policy: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
q => "SHOW RETENTION POLICIES ON mydb",
# or query created from arguments
database => 'mydb',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to list retention policies: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
order_by => 'region',
limit => 10,
offset => 3,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to list series: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
order_by => 'region',
limit => 10,
offset => 3,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to list measurements: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
where => q{host = 'server02'},
limit => 10,
offset => 3,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to list tag keys: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
keys => [qw( "host" "region" )],
limit => 10,
offset => 3,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to list tag values: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
q => "SHOW FIELD KEYS FROM cpu_load",
# or query created from arguments
measurement => 'cpu_load',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to list field keys: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
# or query created from arguments
username => 'jdoe',
password => 'mypassword',
all_privileges => 1,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to create user: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
# or query created from arguments
username => 'jdoe',
password => 'otherpassword',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to set password: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
access => 'ALL',
# or to grant cluster administration privileges
all_privileges => 1,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to grant privileges: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
q => "SHOW GRANTS FOR jdoe",
# or query created from arguments
username => 'jdoe',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to list users: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
access => 'WRITE',
# or to revoke cluster administration privileges
all_privileges => 1,
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to revoke privileges: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
q => "DROP USER jdoe",
# or query created from arguments
username => 'jdoe',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop user: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
name => 'per5minutes',
every => '10s',
for => '2m',
query => 'SELECT MEAN(value) INTO "cpu_load_per5m" FROM cpu_load GROUP BY time(5m)',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to create continuous query: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
# or query created from arguments
database => 'mydb',
name => 'per5minutes',
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop continuous query: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
mode => "ANY",
destinations => [
q{'udp://h1.example.com:9090'},
q{'udp://h2.example.com:9090'}
],
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to create subscription: @_");
}
);
lib/AnyEvent/InfluxDB.pm view on Meta::CPAN
# or query created from arguments
name => q{"alldata"},
database => q{"mydb"},
rp => q{"default"},
# callbacks
on_success => $cv,
on_error => sub {
$cv->croak("Failed to drop subscription: @_");
}
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Inotify/EventReceiver.pm view on Meta::CPAN
=head2 handle_create
Called when a new file, C<$file>, appears in the watched directory.
If it's a directory, we automatically start watching it and calling
callbacks for files in that directory, still relative to the original
directory. C<IN_CREATE>.
=head2 handle_access($file)
Called when C<$file> is accessed. C<IN_ACCESS>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/JSONRPC/HTTP/Server.pm view on Meta::CPAN
Listening port. Default to '8080'.
=back
=head2 reg_cb (%callbacks)
Register JSONRPC methods.
$server->reg_cb(
echo => sub {
view all matches for this distribution