view release on metacpan or search on metacpan
lib/Any/Daemon/FCGI/ClientConn.pm view on Meta::CPAN
( RESPONDER => 1
, AUTHORIZER => 2
, FILTER => 3
);
my %frame_name2id =
( BEGIN_REQUEST => 1
, ABORT_REQUEST => 2
, END_REQUEST => 3
, PARAMS => 4
, STDIN => 5
lib/Any/Daemon/FCGI/ClientConn.pm view on Meta::CPAN
, OVERLOADED => 2
, UNKNOWN_ROLE => 3
);
my %server_role_id2name = reverse %server_role_name2id;
my %frame_id2name = reverse %frame_name2id;
sub new($%) { (bless {}, $_[0])->init($_[1]) }
sub init($)
lib/Any/Daemon/FCGI/ClientConn.pm view on Meta::CPAN
my $body = $self->_read_chunk($clen + $plen);
substr $body, -$plen, $plen, '' if $plen; # remove padding bytes
length $body==$clen or return;
($frame_id2name{$type_id} || 'UNKNOWN_TYPE', $req_id, \$body);
}
sub _reply_record($$$)
{ my ($self, $type, $req_id, $body) = @_;
my $type_id = $frame_name2id{$type} or panic $type;
my $empty = ! length $body; # write one empty frame
while(length $body || $empty)
{ my $chunk = substr $body, 0, MAX_FRAME_SEND, '';
my $size = length $chunk;
my $pad = (-$size) % 8; # advise to pad on 8 bytes
my $frame = pack "CCnnCxa${size}x${pad}"
, FCGI_VERSION, $type_id, $req_id, $size, $pad, $chunk;
while(length $frame)
{ my $wrote = syswrite $self->socket, $frame;
if(defined $wrote)
{ substr $frame, 0, $wrote, '';
next;
}
return unless $! == EAGAIN || $! == EINTR || $! == EWOULDBLOCK;
usleep 1000; # 1 ms
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
examples/server.pl view on Meta::CPAN
my ($fh, $host, $port) = @_;
$log->info("connected (host: $host, port: $port)");
my $ws_handshake = Protocol::WebSocket::Handshake::Server->new;
my $ws_frame = Protocol::WebSocket::Frame->new;
my $handle = AnyEvent::Handle->new(fh => $fh);
$clients{$handle} = { host => $host, port => $port };
$handle->on_error(
examples/server.pl view on Meta::CPAN
}
}
$ws_handshake->is_done() or return;
# Data
$ws_frame->append($chunk);
while (my $message = $ws_frame->next) {
if($message =~ /^Chromi (\d+) (\w+) (.*)$/) {
# Chrome to Client
my ($id, $status, $reply) = ($1, $2, $3);
if(defined $requests{$id}) {
my $c = $requests{$id};
if(defined $clients{$c}) {
my $frame = Protocol::WebSocket::Frame->new($message);
$log->debug("sending reply for $id");
$c->push_write($frame->to_bytes);
}
}
delete $requests{$id};
}
elsif($message =~ /^Chromi \S+ info connected/) {
examples/server.pl view on Meta::CPAN
# register who made the request
$requests{$1} = $handle;
# chrome isn't connected
if(not scalar keys %chromi) {
my $reply = "Chromi $1 error " . uri_escape(encode_json({ error => 'chrome not connected'}));
my $frame = Protocol::WebSocket::Frame->new($reply);
$handle->push_write($frame->to_bytes);
}
else {
for my $key (keys %chromi) {
my $c = $chromi{$key}{handle};
my $frame = Protocol::WebSocket::Frame->new($message);
$c->push_write($frame->to_bytes);
}
}
}
else {
$log->info("other: $message");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/CouchDB.pm view on Meta::CPAN
AnyEvent->condvar->recv;
=head1 DESCRIPTION
AnyEvent::CouchDB is a non-blocking CouchDB client implemented on top of the
L<AnyEvent> framework. Using this library will give you the ability to run
many CouchDB requests asynchronously, and it was intended to be used within
a L<Coro>+L<AnyEvent> environment. However, it can also be used synchronously
if you want.
Its API is based on jquery.couch.js, but we've adapted the API slightly so that
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Discord/Client.pm view on Meta::CPAN
1;
__END__
=head1 NAME
AnyEvent::Discord::Client - A Discord client library for the AnyEvent framework.
=head1 SYNOPSIS
use AnyEvent::Discord::Client;
view all matches for this distribution
view release on metacpan or search on metacpan
sometimes you're extending old code to do something new, and find the existing
tools to not be what you're looking for.
This is an alternative module to AnyEvent::Discord::Client. That module is a
perfectly fine module, but it does a lot of things to make "making a bot"
easier, but doesn't translate well to an existing bot framework. This module
provides an eventing interface common to some of the other AnyEvent interfaces
to chat APIs.
This is still likely unfinished, but opening it up to get some more eyes on it.
view all matches for this distribution
view release on metacpan or search on metacpan
AnyEvent-FileLock
=================
File locking for the AnyEvent framework.
INSTALLATION
To install this module type the following:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Filesys/Notify.pm view on Meta::CPAN
the task of watching files or directories and providing notifications about
changes. Two of which offer a unified interface that work on any system:
L<Filesys::Notify::Simple> and L<File::ChangeNotify>.
L<AnyEvent::Filesys::Notify> exists because I need a way to simply tie the
functionality those modules provide into an event framework. Neither of the
existing modules seem to work with well with an event loop.
L<Filesys::Notify::Simple> does not supply a non-blocking interface and
L<File::ChangeNotify> requires you to poll an method for new events. You could
fork off a process to run L<Filesys::Notify::Simple> and use an event handler
to watch for notices from that child, or setup a timer to check
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Graphite.pm view on Meta::CPAN
}
sub send {
my($self, $id, $value, $ts) = @_;
return unless (defined($id) && defined($value));
$ts ||= AE::now; # cached time() from the framework
if($self->{conn}) {
$self->{conn}->push_write(join(" ", $id, $value, $ts) . "\n");
} else {
my $handle; $handle = new AnyEvent::Handle
connect => [$self->{host} => $self->{port}],
view all matches for this distribution
view release on metacpan or search on metacpan
This module provides an RPC::ExtDirect gateway implementation for
AnyEvent::HTTPD, a simple lightweight event based web server. Unlike
other gateways like Plack::Middleware::ExtDirect or CGI::ExtDirect, this
module is in fact more of an application server than just a plugin. You
can think of it as Plack framework and Plack::Middleware::ExtDirect
combined into one package.
That said, the asynchronous event based nature of AnyEvent::HTTPD allows
using it both as a standalone application server, and as a part of a
larger program that may do other things besides serving Ext.Direct or
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Handle/ZeroMQ.pm view on Meta::CPAN
=head1 DIFFERENCES
There is also a module called L<AnyEvent::ZeroMQ> in CPAN.
AnyEvent::ZeroMQ::* is a huge, heavy,
and full-functioned framework, but this module is a simple,
lightweight library with less dependency, and runs faster.
So this module is only occupy a smaller namespace
under AnyEvent::Handle::
view all matches for this distribution
view release on metacpan or search on metacpan
MANIFEST.SKIP view on Meta::CPAN
^.releaserc
^.*.cmd
^chrome-versions
^AnyEvent-Impl-Prima-.*/
^AnyEvent-Impl-Prima-.*.tar.gz$
^frame-\d+.png
^demo/
^\.carmel/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/InMemoryCache.pm view on Meta::CPAN
time comes. That gives us performance advantage because it need not to check validity of values every
time it fetches values. Also, this can free allocated memory as soon as each value is expired.
=head2 DISADVANTAGE
This module simply does not work unless you use AnyEvent framework correctly.
=head1 METHODS
=head2 C<$class-E<gt>new( expires_in =E<gt> $duration )>
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/KVStore.pm view on Meta::CPAN
$foo->watch($keyspace, \&process_vals);
=head1 DESCRIPTION
The AnyEventLLKVStore framework intends to be a simple, pluggable API for
abstracting away the details of key-value store integratoins in event loop for
the standard operations one is likely to experience in an event loop.
The idea is to make key-value stores reasonably pluggable for variou skinds of
operations so that when one fails to scale in one scenario, another can be used
and alaternatively, the same app can support several different stores.
The framework uses Moo (Minimalist Object Orientation) to procide the basic
interface specifications, and modules providing drivers here are expected to
use Moo for defining accessors, etc.
=head1 ACCESSORS/PROPERTIES
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/LeapMotion.pm view on Meta::CPAN
return bless {
host => '127.0.0.1',
port => 6437,
enable_gesture => 0,
%args,
frame => Protocol::WebSocket::Frame->new(),
}, $class;
}
sub run {
my ($self, $code) = @_;
lib/AnyEvent/LeapMotion.pm view on Meta::CPAN
if ($self->{enable_gesture}) {
$self->send({enableGestures => \1}); # true
}
$self->{handle}->on_read(sub {
$_[0]->push_read(sub {
$self->{frame}->append(delete $_[0]->{rbuf});
if (my $message = $self->{frame}->next_bytes) {
my $data = JSON::decode_json($message);
if (exists $data->{id} && exists $data->{timestamp}) {
$self->call(on_frame => $data);
}
}
});
});
});
lib/AnyEvent/LeapMotion.pm view on Meta::CPAN
}
sub send {
my ($self, $data) = @_;
my $message = JSON::encode_json($data);
my $frame = Protocol::WebSocket::Frame->new($message);
$self->{handle}->push_write($frame->to_bytes);
}
sub call {
my ($self, $name, @args) = @_;
if ($self->{$name}) {
lib/AnyEvent/LeapMotion.pm view on Meta::CPAN
use AnyEvent;
use AnyEvent::LeapMotion;
my $leap = AnyEvent::LeapMotion->new(
enable_gesture => 1,
on_frame => sub {
my $frame = shift;
...
},
);
$leap->run;
lib/AnyEvent/LeapMotion.pm view on Meta::CPAN
Create an instance of AnyEvent::LeapMotion.
=over 4
=item on_frame : Sub
=item on_error : Sub
=item host => '127.0.0.1' : Str
view all matches for this distribution
view release on metacpan or search on metacpan
=head1 NAME
AnyEvent::MP - erlang-style multi-processing/message-passing framework
=head1 SYNOPSIS
use AnyEvent::MP;
# distributed database - monitoring a family
db_mon $family => $cb->(\%familyhash, \@added, \@changed, \@deleted)
=head1 DESCRIPTION
This module (-family) implements a simple message passing framework.
Despite its simplicity, you can securely message other processes running
on the same or other hosts, and you can supervise entities remotely.
For an introduction to this module family, see the L<AnyEvent::MP::Intro>
== aemp node, Erlang process == aemp port), so many of the documents and
programming techniques employed by Erlang apply to AnyEvent::MP. Here is a
sample:
http://www.erlang.se/doc/programming_rules.shtml
http://erlang.org/doc/getting_started/part_frame.html # chapters 3 and 4
http://erlang.org/download/erlang-book-part1.pdf # chapters 5 and 6
http://erlang.org/download/armstrong_thesis_2003.pdf # chapters 4 and 5
Despite the similarities, there are also some important differences:
problems, as long as it isn't a global node and only reaches out to other
nodes (as opposed to being contacted from other nodes).
=item $AnyEvent::MP::Kernel::WARN has gone.
AnyEvent has acquired a logging framework (L<AnyEvent::Log>), and AEMP now
uses this, and so should your programs.
Every module now documents what kinds of messages it generates, with
AnyEvent::MP acting as a catch all.
view all matches for this distribution
view release on metacpan or search on metacpan
get interpreted correctly, but if you accept arbitrary filenamews (e.g.
from the user), you need to do this.
The C<cmd_recv> method then queues the command, waits for a reply and
returns the reply data (or croaks on error). F<mpv> would, at this point,
load the file and, if everything was successful, show the first frame and
pause. Note that, since F<mpv> is implement rather synchronously itself,
do not expect commands to fail in many circumstances - for example, fit
he file does not exit, you will likely get an event, but the C<loadfile>
command itself will run successfully.
position, if it is not at the start of the file (it would probaby be more
efficient to set the starting position before loading the file, though,
but this is good enough).
Then it plays with the display fps, to set it to something harmonious
w.r.t. the video framerate.
If the file does not have a video part, it assumes it is an audio file and
sets a visualizer.
Also, a number of properties are not global, but per-file. At the moment,
} elsif ($INPUT eq "select") {
$mpv->cmd ("osd-msg-bar", "add", "audio-delay", "-0.100");
} elsif ($INPUT eq "start") {
$mpv->cmd ("osd-msg-bar", "add", "audio-delay", "0.100");
} elsif ($INPUT eq "intfwd") {
$mpv->cmd ("no-osd", "frame-step");
} elsif ($INPUT eq "audio") {
$mpv->cmd ("osd-auto", "cycle", "audio");
} elsif ($INPUT eq "subtitle") {
$mpv->cmd ("osd-auto", "cycle", "sub");
} elsif ($INPUT eq "triangle") {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Memcached.pm view on Meta::CPAN
}
} );
=head1 DESCRIPTION
Asyncronous C<memcached/memcachedb> client for L<AnyEvent> framework
=head1 NOTICE
There is a notices in L<Cache::Memcached::AnyEvent> related to this module. They all has been fixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/MockTCPServer.pm view on Meta::CPAN
=head1 ACTION METHOD ARGUMENTS
These methods (and methods added by derived classes) can be used in
action lists passed via the constructor C<connections> parameter. The
C<$handle> and C<$actions> arguments should be omitted from the action
lists as they are supplied by the framework.
=head1 ACTION METHODS
=head2 C<send($handle, $actions, $send, $desc)>
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
our @EXPORT = ();
our @EXPORT_BASE = qw(field const stub super);
our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
our %EXPORT_TAGS = (XXX => [qw(WWW XXX YYY ZZZ)]);
my $stack_frame = 0;
my $dump = 'yaml';
my $bases_map = {};
sub WWW; sub XXX; sub YYY; sub ZZZ;
inc/Spiffy.pm view on Meta::CPAN
unless grep /^XXX$/, @EXPORT_BASE;
}
spiffy_filter()
if ($args->{-selfless} or $args->{-Base}) and
not $filtered_files->{(caller($stack_frame))[1]}++;
my $caller_package = $args->{-package} || caller($stack_frame);
push @{"$caller_package\::ISA"}, $self_package
if $args->{-Base} or $args->{-base};
for my $class (@{all_my_bases($self_package)}) {
next unless $class->isa('Spiffy');
inc/Spiffy.pm view on Meta::CPAN
}
package Spiffy;
sub super {
my $method;
my $frame = 1;
while ($method = (caller($frame++))[3]) {
$method =~ s/.*::// and last;
}
my @args = DB::super_args($frame);
@_ = @_ ? ($args[0], @_) : @args;
my $class = ref $_[0] ? ref $_[0] : $_[0];
my $caller_class = caller;
my $seen = 0;
my @super_classes = reverse grep {
inc/Spiffy.pm view on Meta::CPAN
for my $base_class (@base_classes) {
next if $inheritor->isa($base_class);
croak "Can't mix Spiffy and non-Spiffy classes in 'use base'.\n",
"See the documentation of Spiffy.pm for details\n "
unless $base_class->isa('Spiffy');
$stack_frame = 1; # tell import to use different caller
import($base_class, '-base');
$stack_frame = 0;
}
}
sub mixin {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Pg.pm view on Meta::CPAN
*** ***
*******************************************************************
This library allows to query PostgreSQL databases asynchronously. It
is a thin layer on top of L<Pg::PQ> that integrates it inside the
L<AnyEvent> framework.
=head2 API
The following methods are available from the AnyEvent::Pg class:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Process.pm view on Meta::CPAN
Run the close method of the latest created AnyEvent::Process::Job.
=head1 SEE ALSO
L<AnyEvent> - Event framework for PERL.
L<AnyEvent::Subprocess> - Similar module, but with more dependencies and a little
more complicated usage.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent.pm view on Meta::CPAN
baggage? To explore this, I wrote the equivalent benchmark for AnyEvent.
The benchmark itself creates an echo-server, and then, for 500 times,
connects to the echo server, sends a line, waits for the reply, and then
creates the next connection. This is a rather bad benchmark, as it doesn't
test the efficiency of the framework or much non-blocking I/O, but it is a
benchmark nevertheless.
name runtime
Lambda/select 0.330 sec
+ optimized 0.122 sec
view all matches for this distribution