/usr/lib/perl5/AnyEvent/Impl/Event.pm is in libanyevent-perl 7.070-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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | =head1 NAME
AnyEvent::Impl::Event - AnyEvent adaptor for Event
=head1 SYNOPSIS
use AnyEvent;
use Event;
# this module gets loaded automatically as required
=head1 DESCRIPTION
This module provides transparent support for AnyEvent. You don't have to
do anything to make Event work with AnyEvent except by loading Event before
creating the first AnyEvent watcher.
The event module is reasonably efficient and generally works correctly
even with many watchers, except that its signal handling is inherently
racy and requires the wake-up-frequently workaround.
=cut
package AnyEvent::Impl::Event;
use AnyEvent (); BEGIN { AnyEvent::common_sense }
use Event qw(unloop); # we have to import something to make Event use Time::HiRes
sub io {
my (undef, %arg) = @_;
$arg{fd} = delete $arg{fh};
$arg{poll} .= "e" if AnyEvent::WIN32; # work around windows connect bug
my $cb = $arg{cb}; $arg{cb} = sub { &$cb }; # event doesn't like callable objects
bless \(Event->io (%arg)), __PACKAGE__
}
sub timer {
my (undef, %arg) = @_;
$arg{after} = 0 if $arg{after} < 0;
my $cb = $arg{cb}; $arg{cb} = sub { &$cb }; # event doesn't like callable objects
bless \Event->timer (%arg, repeat => $arg{interval}), __PACKAGE__
}
sub idle {
my (undef, %arg) = @_;
my $cb = $arg{cb}; $arg{cb} = sub { &$cb }; # event doesn't like callable objects
bless \Event->idle (repeat => 1, min => 0, %arg), __PACKAGE__
}
sub DESTROY {
${$_[0]}->cancel;
}
sub signal {
my (undef, %arg) = @_;
my $cb = $arg{cb};
my $w = Event->signal (
signal => AnyEvent::Base::sig2name $arg{signal},
cb => sub { &$cb }, # event doesn't like callable objects
);
AnyEvent::Base::_sig_add;
bless \$w, "AnyEvent::Impl::Event::signal"
}
sub AnyEvent::Impl::Event::signal::DESTROY {
AnyEvent::Base::_sig_del;
${$_[0]}->cancel;
}
sub _poll {
Event::one_event;
}
sub AnyEvent::CondVar::Base::_wait {
Event::one_event until exists $_[0]{_ae_sent};
}
#sub loop {
# Event::loop;
#}
=head1 SEE ALSO
L<AnyEvent>, L<Event>.
=head1 AUTHOR
Marc Lehmann <schmorp@schmorp.de>
http://anyevent.schmorp.de
=cut
1
|