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


AnyEvent-Stomper

 view release on metacpan or  search on metacpan

examples/publisher.pl  view on Meta::CPAN

);

my $cv  = AE::cv;
my $num = 1;

my $timer;
$timer = AE::timer( 0, 1,
  sub {
    my $body = 'foo' . $num++;

    $stomper->send(
      destination => '/queue/foo',

 view all matches for this distribution


AnyEvent-Sub-Retry

 view release on metacpan or  search on metacpan

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


sub retry {
    my ( $retry_count, $retry_interval, $code_ref ) = @_;

    my $all_cv = AE::cv;
    my $timer;
    my $try;
    $try = sub {
        my $cv = eval { $code_ref->() };
        if ($@) {
            undef $try;

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

            sub {
                my @vals = eval { shift->recv };
                if ($@) {
                    $retry_count--;
                    if ( $retry_count > 0 ) {
                        $timer = AnyEvent->timer(
                            cb => sub { $try->(); undef $timer; },
                            after => $retry_interval,
                        );
                    }
                    else {
                        undef $try;

 view all matches for this distribution


AnyEvent-Subprocess

 view release on metacpan or  search on metacpan

examples/synopsis.pl  view on Meta::CPAN


# close stdin after it has been written to the child
$run->delegate('stdin')->handle->on_drain(sub { $_[0]->close_fh });

# kill the child if it takes too long to produce a result
$killer = AnyEvent->timer( after => 2, interval => 0, cb => sub {
    warn "TOO SLOW.  BAI.";
    $run->kill(2);              # SIGINT.
});

$cv->cb( sub { $cv->recv; exit 0 } );

 view all matches for this distribution


AnyEvent-Superfeedr

 view release on metacpan or  search on metacpan

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

      password => $password,
  );
  $superfeedr->connect(sub { $superfeedr->subscribe($feed_uri) });

  # Periodically fetch new URLs from database and subscribe
  my $timer = AnyEvent->timer(
      after => 5,
      interval => 5 * 60,
      cb => sub {
          my @new_feeds = get_new_feeds_from_database() or return;
          $superfeedr->subscribe(@new_feeds);

 view all matches for this distribution


AnyEvent-Sway

 view release on metacpan or  search on metacpan

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


    my $cv = AnyEvent->condvar;

    my $version_cv = $self->message(TYPE_GET_VERSION);
    my $timeout;
    $timeout = AnyEvent->timer(
        after => 1,
        cb => sub {
            warn "Falling back to sway --version since the running Sway doesn’t support GET_VERSION yet.";
            my $version = _call_sway('--version');
            $version =~ s/^sway version //;

 view all matches for this distribution


AnyEvent-Task

 view release on metacpan or  search on metacpan

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


Both client and server are of course built with L<AnyEvent>. However, workers can't use AnyEvent (yet). I've never found a need to do event processing in the worker since if the library you wish to use is already AnyEvent-compatible you can simply us...

Each client maintains a "pool" of connections to worker processes. Every time a checkout is requested, the request is placed into a first-come, first-serve queue. Once a worker process becomes available, it is associated with that checkout until that...

C<timeout> can be passed as a keyword argument to C<checkout>. Once a request is queued up on that checkout, a timer of C<timout> seconds (default is 30, undef means infinity) is started. If the request completes during this timeframe, the timer is c...

Note that since timeouts are associated with a checkout, checkouts can be created before the server is started. As long as the server is running within C<timeout> seconds, no error will be thrown and no requests will be lost. The client will continua...

Because of checkout queuing, the maximum number of worker processes a client will attempt to obtain can be limited with the C<max_workers> argument when creating a client object. If there are more live checkouts than C<max_workers>, the remaining che...

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

      name => 'sleeper',
      listen => ['unix/', '/tmp/anyevent-task.socket'],
      interface => sub {
        logger->info('about to compute some operation');
        {
          my $timer = logger->timer('computing some operation');
          select undef,undef,undef, 1; ## sleep for 1 second
        }
      },
    )->run;

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

                        '1.025965',
                        30,
                        'finished some operation'
                      ]
                    ],
          'timers' => {
                        'computing some operation' => [
                                                        '0.024089061050415',
                                                        '1.02470206105041'
                                                      ]
                      }

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

  - start delivering fatal errors to some (at front of queue or back of queue though?)
  - write test for this

! docs: write good error handling examples

Make names more consistent between callback::frame backtraces and auto-generated log::defer timers

make server not use AnyEvent so don't have to worry about workers unlinking unix socket in dtors

In a graceful shutdown scenario, servers wait() on all their children before terminating.
  - Support relinquishing accept() socket during this period?

 view all matches for this distribution


AnyEvent-TermKey

 view release on metacpan or  search on metacpan

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

         while( ( $ret = $termkey->getkey( my $key ) ) == RES_KEY ) {
            $on_key->( $key );
         }

         if( $ret == RES_AGAIN ) {
            $timeout = AnyEvent->timer(
               after => $termkey->get_waittime / 1000,
               cb => sub {
                  if( $termkey->getkey_force( my $key ) == RES_KEY ) {
                     $on_key->( $key );
                  }

 view all matches for this distribution


AnyEvent-Tickit

 view release on metacpan or  search on metacpan

examples/demo-timer.pl  view on Meta::CPAN

{
   $fg++;
   $fg = 1 if $fg > 7;
   $static->pen->chattr( fg => $fg );

   $tickit->timer( after => 0.5, \&tick );
}
tick();

$tickit->set_root_widget( $vbox );

 view all matches for this distribution


AnyEvent-Timer-Cron

 view release on metacpan or  search on metacpan

lib/AnyEvent/Timer/Cron.pm  view on Meta::CPAN

            return sub { $cron->get_next_valid_time_after(@_) };
        }
        die "Invalid cron!";
    },
);
has '_timer' => (is => 'rw');

sub BUILD {
    my $self = shift;
    $self->create_timer;
}

sub create_timer {
    my $self = shift;
    weaken $self;
    my $now = DateTime->from_epoch(epoch => AnyEvent->now);
    $now->set_time_zone( $self->time_zone ) if $self->time_zone;
    my $next = $self->next_event($now);
    return
        if not $next;
    my $interval = $next->subtract_datetime_absolute($now)->in_units('nanoseconds') / 1_000_000_000;
    $self->_timer(AnyEvent->timer(
        after => $interval,
        cb => sub {
            $self->{cb}->();
            $self && $self->create_timer;
        },
    ));
}

sub next_event {

lib/AnyEvent/Timer/Cron.pm  view on Meta::CPAN

1;
__END__

=head1 NAME

AnyEvent::Timer::Cron - cron based timers for AnyEvent

=head1 SYNOPSIS

    use AnyEvent;
    use AnyEvent::Timer::Cron;

lib/AnyEvent/Timer/Cron.pm  view on Meta::CPAN

    });
    AnyEvent->condvar->recv;

=head1 DESCRIPTION

This module creates timers based on cron rules.

This module primarily exists to replace similar that try to do too
much work, instead providing the simplest implementation, and using
AnyEvent's standard conventions for timer lifetime.

=head1 METHODS

=head2 new( cron => $cron, cb => sub {} )

Creates a new cron timer.  The callback will be called continually
according to the cron rules until the object is destroyed.

=over 4

=item cron

 view all matches for this distribution


AnyEvent-Tools

 view release on metacpan or  search on metacpan

lib/AnyEvent/Tools/Buffer.pm  view on Meta::CPAN

    my (%opts) = @_;

    my $self = bless {
        queue       => [],
        exists      => {},
        timer       => undef,
        lock        => 0,
        do_flush    => 0,
        unique_cb   => undef,
    } => ref($class) || $class;

lib/AnyEvent/Tools/Buffer.pm  view on Meta::CPAN


sub interval
{
    my ($self, $ival) = @_;
    return $self->{interval} if @_ == 1;
    undef $self->{timer} unless $ival;
    return $self->{interval} = $ival;
}

sub on_flush
{

lib/AnyEvent/Tools/Buffer.pm  view on Meta::CPAN

    return unless $self->{on_flush};
    if ($self->{lock}) {
        $self->{do_flush} = 1;
        return;
    }
    undef $self->{timer};
    my $queue = $self->{queue};
    $self->{queue} = [];
    $self->{exists} = {};
    my $guard = guard sub {

lib/AnyEvent/Tools/Buffer.pm  view on Meta::CPAN


    return if $self->{lock};
    return unless $self->{on_flush};

    unless (@{ $self->{queue} }) {
        undef $self->{timer};
        return;
    }

    if ($self->size) {
        if (@{ $self->{queue} } >= $self->size) {
            $self->flush;
            return;
        }
    }

    return if $self->{timer};
    return unless $self->interval;
    $self->{timer} = AE::timer $self->interval, 0 => sub { $self->flush };
    return;
}

1;

 view all matches for this distribution


AnyEvent-Twitter-Stream

 view release on metacpan or  search on metacpan

eg/track.pl  view on Meta::CPAN

        $done->send;
    },
);

# uncomment to test undef $streamer
# my $t = AE::timer 1, 0, sub { undef $streamer };

$done->recv;

 view all matches for this distribution


AnyEvent-UserAgent

 view release on metacpan or  search on metacpan

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

	}

	my ($grd, $tmr);

	if ($opts->{request_timeout}) {
		$tmr = AE::timer $opts->{request_timeout}, 0, sub {
			undef($grd);
			$cb->($opts, undef, {Status => 597, Reason => 'Request timeout'});
		};
	}
	$grd = AnyEvent::HTTP::http_request(

 view all matches for this distribution


AnyEvent-Watchdog

 view release on metacpan or  search on metacpan

Watchdog/Util.pm  view on Meta::CPAN


=item use AnyEvent::Watchdog heartbeat => $interval

Tells the supervisor to automatically kill the program if it doesn't
react for C<$interval> seconds (minium 1, maximum 255, default 60) , then
installs an AnyEvent timer the sends a regular heartbeat to the supervisor
twice as often.

Exit behaviour isn't changed, so if you want a restart instead of an exit,
you have to call C<autorestart>.

Watchdog/Util.pm  view on Meta::CPAN

   $interval = int $interval;

   syswrite $C, "\x03" . chr $interval
      if $C;

   $HEARTBEAT_W = AE::timer 0, $interval * 0.5, sub {
      syswrite $C, "\x04"
         if $C;
   };
}

 view all matches for this distribution


AnyEvent-WebService-Tracks

 view release on metacpan or  search on metacpan

t/lib/Test/AnyEvent/WebService/Tracks.pm  view on Meta::CPAN

    my ( $cb ) = @_;
    my ( undef, $file, $line ) = caller;

    my $cond = AnyEvent->condvar;

    my $timer_has_fired = 0;
    my $timer = AnyEvent->timer(
        after => 30,
        cb    => sub {
            $timer_has_fired = 1;
            Test::More::fail("Timeout at $file, line $line");
            $cond->send;
        },
    );

t/lib/Test/AnyEvent/WebService/Tracks.pm  view on Meta::CPAN

    };
    if($@) {
        Test::More::fail($@);
    } else {
        $cond->recv;
        Test::More::pass unless $timer_has_fired;
    }
}

sub import {
    my ( undef, @args ) = @_;

 view all matches for this distribution


AnyEvent-WebSocket-Client

 view release on metacpan or  search on metacpan

t/lib/Test2/Plugin/AnyEvent/Timeout.pm  view on Meta::CPAN


sub import
{
  return if defined $timeout;

  $timeout = AnyEvent->timer(
    after => 30,
    cb => sub {
      my $ctx = context();
      $ctx->bail("Test exceeded timeout of 30s");
      $ctx->release;

 view all matches for this distribution


AnyEvent-WebSocket-Server

 view release on metacpan or  search on metacpan

t/testlib/Util.pm  view on Meta::CPAN


sub set_timeout {
    my ($timeout) = @_;
    $timeout ||= 10;
    my $w;
    $w = AnyEvent->timer(after => $timeout, cb => sub {
        fail("Timeout");
        undef $w;
        exit 2;
    });
}

 view all matches for this distribution


AnyEvent-Whois-Raw

 view release on metacpan or  search on metacpan

lib/AnyEvent/Whois/Raw.pm  view on Meta::CPAN

			return;
		}
		
		my @lines;
		my $handle;
		my $timer = AnyEvent->timer(
			after => exists $stash_ref->{params}{timeout} ?
					$stash_ref->{params}{timeout} :
					$Net::Whois::Raw::TIMEOUT||30,
			cb => sub {
				if ($handle && !$handle->destroyed) {

lib/AnyEvent/Whois/Raw.pm  view on Meta::CPAN

				}
				push @lines, @l;
				$_[0]->{rbuf} = '';
			},
			on_error => sub {
				undef $timer;
				$handle->destroy();
				local $stash = $stash_ref;
				$stash->{calls}{whois_query} = 0;
				my $i = push @{$stash->{results}{whois_query}}, undef;
				$stash->{errors}{whois_query}[$i-1] = "Read error from $srv: $!";
				$stash->{caller}->(@{$stash->{args}});
			},
			on_eof => sub {
				undef $timer;
				local $stash = $stash_ref;
				$handle->destroy();
				$stash->{calls}{whois_query} = 0;
				push @{$stash->{results}{whois_query}}, \@lines;
				$stash->{caller}->(@{$stash->{args}});

 view all matches for this distribution


AnyEvent-Worker

 view release on metacpan or  search on metacpan

ex/worker-pool.pl  view on Meta::CPAN

	$cv->begin;
	$pool->do( test => "Test:$id" , sub {
		#my $g = AnyEvent::Util::guard { $j1->(); $cv->end; };
		return warn "Request died: $@\n" if $@;
		warn "Received response: @_\n";
		my $t;$t = AnyEvent->timer(after => 1, cb => sub {
			undef $t;
			#undef $g;
			$cv->end;
			$j1->();
		});

 view all matches for this distribution


AnyEvent-XMPP

 view release on metacpan or  search on metacpan

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


=over 4

=item L<AnyEvent>

For the I/O events, timers, TCP, TLS, DNS and I/O buffering.

=item L<Object::Event>

The former L<AnyEvent::XMPP::Event> module has been outsourced to the L<Object::Event>
module to provide a more generic way for more other modules to register and call

 view all matches for this distribution


AnyEvent-XSPromises

 view release on metacpan or  search on metacpan

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

Returns true iff the C<reject> or C<resolve> method has not been called yet. Useful for racing multiple code paths to
resolve/reject a single deferred object, like one would do to build a timeout.

    sub get_with_timeout {
        my $d= deferred;
        my $timer; $timer= AE::timer 1, 0, sub {
            undef $timer;
            $d->reject("Timed out") if $d->is_in_progress;
        };

        http_get("https://perl.org", sub {
            my $result= shift

 view all matches for this distribution


AnyEvent-YACurl

 view release on metacpan or  search on metacpan

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


        } else {
            warn "Don't understand what==$what";
        }
    },
    sub { # timerset
        my ($client, $time_ms)= @_;

        if ($time_ms == -1) {
            delete $TIMER{$$client};
            return;
        }

        AE::now_update;
        $TIMER{$$client}= AE::timer(($time_ms / 1000), 0, sub {
            delete $TIMER{$$client};
            _ae_timer_fired($client);
        });
    }
);

1;

 view all matches for this distribution


AnyEvent-Yubico

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension AnyEvent::Yubico.

0.9.3  Wed Mar 06 11:31:03 2013
	- Replaced usage of AnyEvent->timer for timeouts with setting
	  the timeout parameter for each HTTP connection, as the timer
	  was showing some incorrect behavior.

0.9.2  Fri Feb 22 14:09:06 2013
	- Fixed bug preventing verify from working.
	- Lowered the required version of AnyEvent::HTTP to ensure that

 view all matches for this distribution


AnyEvent-ZabbixSender

 view release on metacpan or  search on metacpan

ZabbixSender.pm  view on Meta::CPAN

   my ($self) = @_;

   while (@{ $self->{queue} } || $self->{sending}) {
      my $cv = AE::cv;

      my $to = AE::timer $self->{linger_time}, 0, $cv;
      local $self->{on_clear} = $cv;

      $cv->recv;
   }
}

ZabbixSender.pm  view on Meta::CPAN

sub _send {
   my ($self) = @_;

   if ($self->{delay}) {
      Scalar::Util::weaken $self;
      $self->{delay_w} ||= AE::timer $self->{delay}, 0, sub {
         delete $self->{delay_w};
         $self->{send_immediate} = 1;
         $self->_send2 unless $self->{sending}++;
      };
   } else {

ZabbixSender.pm  view on Meta::CPAN

      return;
   }

   my $retry = $self->{retry_min} * 2 ** $self->{retry}++;
   $retry = $self->{retry_max} if $retry > $self->{retry_max};
   $self->{retry_w} = AE::timer $retry, 0, sub {
      delete $self->{retry_w};
      $self->_send2;
   };
}

 view all matches for this distribution


AnyEvent-mDNS

 view release on metacpan or  search on metacpan

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

      my $service = shift;
      # ...
  }, $cv;
  $cv->recv;

You can obviously write your own AnyEvent timer loop to run this mDNS
query from time to time with smart interval (See the Multicast DNS
Internet Draft for details), to keep the discovered list up-to-date.

=back

 view all matches for this distribution


AnyMQ-AMQP

 view release on metacpan or  search on metacpan

lib/AnyMQ/Trait/AMQP.pm  view on Meta::CPAN

        else {
            my $cv = AE::cv;
            $cv->cb($cb);
            $self->cv($cv);
            carp "Connection failed, retrying in 5 seconds.  Reason: ".$msg;
            my $w; $w = AnyEvent->timer(after => 5,
                                        cb => sub {
                                            undef $w;
                                            $self->connect($cv);
                                        });
        }

 view all matches for this distribution


AnyMQ-ZeroMQ

 view release on metacpan or  search on metacpan

t/10-pubsub.t  view on Meta::CPAN

    $pub_topic->publish({ type => 'ping', params => { bleep => 'bloop' } });

    $cv->recv;

    $cv = AE::cv;
    my $t = AnyEvent->timer(
        after => 1.5,
        cb => sub {
            $cv->send;
        },
    );

 view all matches for this distribution


AnyMQ

 view release on metacpan or  search on metacpan

lib/AnyMQ/Queue.pm  view on Meta::CPAN

    if ($self->{persistent}) {
        $self->{cv}->cb($cb);
        $self->_flush( @{ $self->{buffer} })
            if @{ $self->{buffer} };
    } else {
        $self->{timer} = $self->_reaper;
    }

}

sub _reaper {
    my ($self, $timeout) = @_;

    AnyEvent->timer(
        after => $timeout || $self->timeout,
        cb => sub {
            weaken $self;
            warn "Timing out $self long-poll" if DEBUG;
            if ($self->on_timeout) {

lib/AnyMQ/Queue.pm  view on Meta::CPAN

    $self->{cv}->cb(sub { $cb->($_[0]->recv) });

    # reset garbage collection timeout with the long-poll timeout
    # $timeout = 0 is a valid timeout for interval-polling
    $timeout = 55 unless defined $timeout;
    $self->{timer} = AE::timer $timeout || 55, 0, sub {
        weaken $self;
        warn "long-poll timeout, flush and wait for client reconnect" if DEBUG;
        $self->_flush;
    };
    weaken $self->{timer};

    # flush buffer for a long-poll client
    $self->_flush( @{ $self->{buffer} })
        if @{ $self->{buffer} };
}

lib/AnyMQ/Queue.pm  view on Meta::CPAN

sub poll {
    my ($self, $cb) = @_;
    $self->cv->cb(sub { $cb->($_[0]->recv) });
    $self->persistent(1);

    undef $self->{timer};

    $self->_flush( @{ $self->{buffer} })
        if @{ $self->{buffer} };
}

sub unpoll {
    my $self = shift;
    $self->cv->cb(undef);
    $self->persistent(0);
    $self->{timer} = $self->_reaper;
}

__PACKAGE__->meta->make_immutable;
no Any::Moose;
1;

 view all matches for this distribution


AnyMongo

 view release on metacpan or  search on metacpan

lib/AnyMongo/Connection.pm  view on Meta::CPAN

    my ($self,%args) = @_;
    return if $self->connected || $self->{_trying_connect};
    # warn "connect...\n";
    $self->{_trying_connect} = 1;
    #setup connection timeout watcher
    my $timer; $timer = AnyEvent->timer( after => 5 ,cb => sub {
        undef $timer;
        unless ( $self->connected ) {
            $self->{_trying_connect} = 0;
            $self->cv->croak('Failed to connect to any mongodb servers,timeout');
        }
    });
    $self->cv->begin( sub {
        undef $timer;
        if ($self->connected) {
            $self->_connection_error(0);
            shift->send;
        }
        else {

lib/AnyMongo/Connection.pm  view on Meta::CPAN

sub receive_data {
    my ($self,$size,$hd) = @_;
    $hd ||= $self->master_handle;
    croak 'connection lost' unless $hd or $self->_check_connection;
    my $cv = AE::cv;
    my $timer; $timer = AnyEvent->timer( after => $self->query_timeout ,cb => sub {
        undef $timer;
        $cv->croak('receive_data timeout');
    });
    $hd->push_read(chunk => $size, sub {
        my ($hdl, $bytes) = @_;
        $cv->send($_[1]);

 view all matches for this distribution


AnySan

 view release on metacpan or  search on metacpan

eg/XppaiSan.pl  view on Meta::CPAN

    channels => {
        '#anysan1' => {},
        '#anysan2' => {},
    };

my $timer; $timer = AnyEvent->timer(
    interval => 55,
    cb => sub {
        for ('#anysan1', '#anysan2' ) {
            $irc->send_message( '??', channel => $_ );
            $irc2->send_message( '????', channel => $_ );

 view all matches for this distribution


Apache-AppSamurai

 view release on metacpan or  search on metacpan

examples/conf/appsamurai-owa.conf  view on Meta::CPAN


  # Set hard expiration (no matter what, the session is killed after this
  # many seconds)
  PerlSetVar OwaSessionExpire 86400

  # Override the previously configured inactivity timer (only applies to this
  # directory)  0 disables the timer
  PerlSetVar OwaSessionTimeout 0

  # ActiveSync does not maintain session cookies.  This sets up a "custom
  # keysource" to compute the session authentication key based on a set of
  # headers and arguments.  (Sort of a pseudo-cookie).  This avoids losing

 view all matches for this distribution


( run in 1.036 second using v1.01-cache-2.11-cpan-49f99fa48dc )