/usr/share/doc/libfuture-perl/examples/anyevent.pl is in libfuture-perl 0.29-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | package Future::AnyEvent;
use base qw( Future );
use AnyEvent;
sub await
{
my $self = shift;
my $cv = AnyEvent->condvar;
$self->on_ready( sub { $cv->send } );
$cv->recv;
}
sub new_delay
{
my $self = shift->new;
$self->{w} = AnyEvent->timer( after => shift, cb => $self->done_cb );
return $self;
}
package main;
my $timer = Future::AnyEvent->new_delay( 3 );
print "Awaiting 3 seconds...\n";
$timer->get;
print "Done\n";
|