Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,31 @@
use AnyEvent;
# a new condition with a callback:
my $quit = AnyEvent->condvar(
cb => sub {
warn "Bye!\n";
}
);
# a new timer, starts after 2s and repeats every 0.25s:
my $counter = 1;
my $hi = AnyEvent->timer(
after => 2,
interval => 0.25,
cb => sub {
warn "Hi!\n";
# flag the condition as ready after 4 times:
$quit->send if ++$counter > 4;
}
);
# another timer, runs the callback once after 1s:
my $hello = AnyEvent->timer(
after => 1,
cb => sub {
warn "Hello world!\n";
}
);
# wait for the $quit condition to be ready:
$quit->recv();

View file

@ -0,0 +1,15 @@
use AnyEvent;
my $quit = AE::cv sub { warn "Bye!\n" };
my $counter = 1;
my $hi = AE::timer 2, 0.25, sub {
warn "Hi!\n";
$quit->send if ++$counter > 4;
};
my $hello = AE::timer 1, 0, sub {
warn "Hello world!\n";
};
$quit->recv;