view release on metacpan or search on metacpan
sub kill {
my ($self) = @_;
$self->clean;
$self->{coro}->cancel;
}
our @queue;
our $queue_change = new Coro::Signal;
our $queue_alloc = 0;
sysopen $self->{fh}, $self->{file}, O_RDWR|O_CREAT, 0600
#$self->{fh} = aio_open $self->{file}, O_RDWR|O_CREAT, 0600
or die "$self->{file}: $!";
$self->{status} = "starting";
$self->{coro} = async {
$self->save;
for(;;) {
my ($state, @args) = ref $self->{p}{state} ? @{$self->{p}{state}} : $self->{p}{state};
my $next = eval { $self->can ("state_$state")->($self, @args) };
view all matches for this distribution
view release on metacpan or search on metacpan
Debian_CPANTS.txt view on Meta::CPAN
"libconvert-binary-c-perl", "Convert-Binary-C", "0.74", "0", "0"
"libconvert-binhex-perl", "Convert-BinHex", "1.119", "1", "1"
"libconvert-color-perl", "Convert-Color", "0.05", "0", "0"
"libconvert-pem-perl", "Convert-PEM", "0.07", "1", "0"
"libconvert-uulib-perl", "Convert-UUlib", "1.12", "1", "0"
"libcoro-perl", "Coro", "5.210", "0", "1"
"libcoy-perl", "Coy", "0.06", "0", "1"
"libcpan-checksums-perl", "CPAN-Checksums", "2.03", "0", "0"
"libcpan-distnameinfo-perl", "CPAN-DistnameInfo", "0.09", "0", "0"
"libcpan-inject-perl", "CPAN-Inject", "0.11", "0", "1"
"libcpan-mini-perl", "CPAN-Mini", "0.576", "0", "0"
Debian_CPANTS.txt view on Meta::CPAN
"libnet-rawip-perl", "Net-RawIP", "0.25", "0", "2"
"libnet-rblclient-perl", "Net-RBLClient", "0.5", "0", "0"
"libnet-rendezvous-publish-backend-avahi-perl", "Net-Rendezvous-Publish-Backend-Avahi", "0.03", "0", "0"
"libnet-rendezvous-publish-perl", "Net-Rendezvous-Publish", "0.04", "0", "0"
"libnet-scp-expect-perl", "Net-SCP-Expect", "0.16", "0", "0"
"libnet-server-coro-perl", "Net-Server-Coro", "not-uploaded", "0", "0"
"libnet-sftp-foreign-perl", "Net-SFTP-Foreign", "1.55", "0", "0"
"libnet-sieve-perl", "Net-Sieve", "0.05", "0", "0"
"libnet-sieve-script-perl", "Net-Sieve-Script", "0.08", "0", "0"
"libnet-sip-perl", "Net-SIP", "0.54", "0", "1"
"libnet-smpp-perl", "Net-SMPP", "1.12", "0", "1"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/IMAP/Server.pm view on Meta::CPAN
=head2 connection
Returns the currently active L<Net::IMAP::Server::Connection> object,
if there is one. This is determined by examining the current
coroutine.
=cut
sub connection {
my $class = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
#CRON: netgroup @chelsea_working NIGHTLY 50 job2
#CRON: host corona NIGHTLY 60 job3
#CRON: netgroup @chelsea_working NIGHTLY 40 job1
#CRON: host corona * 0 * * 6 -1 -2 job7
#CRON: netgroup @chelsea_working * 0 * * 6 -1 -2 job7
#CRON: user ckee
view all matches for this distribution
view release on metacpan or search on metacpan
t/cache/public_suffix_list.dat view on Meta::CPAN
samsung
// sandvik : 2014-11-13 Sandvik AB
sandvik
// sandvikcoromant : 2014-11-07 Sandvik AB
sandvikcoromant
// sanofi : 2014-10-09 Sanofi
sanofi
// sap : 2014-03-27 SAP AG
view all matches for this distribution
view release on metacpan or search on metacpan
t/00_compile.t
t/01_localqueue.t
xt/01_podspell.t
xt/02_perlcritic.t
xt/03_pod.t
xt/04_coro.t
xt/05_multi_channel.t
xt/perlcriticrc
view all matches for this distribution
view release on metacpan or search on metacpan
- Added Debug=2 and DebugPath for writing debug data to files
- added missing reconnect_pass callback response
0.07 2013-09-12
- Made it work faster(especially on longer response servers) and more efficient by removing coro sleep in favor of readable on the handle
0.06 2013-09-10
- Fixed to work with Perl 5.10 and below
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Server/Coro.pm view on Meta::CPAN
sub post_bind_hook {
my $self = shift;
my $prop = $self->{server};
delete $prop->{select};
# set up coro::specific variables
foreach my $key (qw(client sockaddr sockport sockhost peeraddr peerport peerhost peername)) {
tie $prop->{$key}, Coro::Specific::;
}
}
lib/Net/Server/Coro.pm view on Meta::CPAN
expects_ssl => $is_ssl,
);
return $socket;
}
sub coro_instance {
my $self = shift;
my $fh = shift;
my $prop = $self->{server};
$Coro::current->desc("Active connection");
$prop->{client} = $fh;
lib/Net/Server/Coro.pm view on Meta::CPAN
." Local: \"[$prop->{'sockaddr'}]:$prop->{'sockport'}\"") if $prop->{'log_level'} && 3 <= $prop->{'log_level'};
}
=head2 loop
The main loop uses starts a number of L<Coro> coroutines:
=over 4
=item *
lib/Net/Server/Coro.pm view on Meta::CPAN
=item *
One for each active connection. Since these may respawn on a firlay
frequent basis, L<Coro/async_pool> is used to maintain a pool of
coroutines.
=item *
An L<AnyEvent> infinite wait, which equates to the "run the event loop."
lib/Net/Server/Coro.pm view on Meta::CPAN
async {
$Coro::current->desc("Listening on port @{[$socket->sockport]}");
while (1) {
my $accepted = scalar $socket->accept;
next unless $accepted;
async_pool \&coro_instance, $self, $accepted;
}
};
}
async {
lib/Net/Server/Coro.pm view on Meta::CPAN
=head1 BUGS AND LIMITATIONS
The client filehandle, socket, and peer information all use
L<Coro::Specific> in order to constrain their information to their
coroutine. Attempting to access them from a different coroutine will
yield possibly unexpected results.
Generally, all those of L<Coro>. Please report any bugs or feature
requests specific to L<Net::Server::Coro> to
C<bug-net-server-coro@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHORS
Alex Vandiver C<< <alexmv@bestpractical.com> >>; code originally from
view all matches for this distribution
view release on metacpan or search on metacpan
WS_FRAGMENTED_EOF - End of message.
=head2 wait(cb)
Callback called when send queue becomes empty. If callback isn't specified, then tryes to use Coro::rouse_cb & Coro::rouse_wait to block current coro.
=head2 queued_count()
Returns number of messages in send queue
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Whois/Raw/Data.pm view on Meta::CPAN
XN--NODE whois.itdc.ge
XN--3E0B707E whois.kr
XN--CG4BKI whois.kr
SANDVIKCOROMANT whois.nic.sandvikcoromant
SCOR whois.nic.scor
SEVEN whois.nic.seven
lib/Net/Whois/Raw/Data.pm view on Meta::CPAN
'whois.registry.knet.cn' => 'The queried object does not exist: ',
'whois.sgnic.sg' => 'Domain Not Found',
'whois.thnic.co.th' => 'No match for',
'whois.itdc.ge' => 'NO OBJECT FOUND',
'whois.kr' => 'The requested domain was not found',
'whois.nic.sandvikcoromant' => 'No Data Found',
'whois.nic.scor' => 'No Data Found',
'whois.nic.seven' => 'No Data Found',
'whois.nic.sydney' => 'No Data Found',
'whois.nic.tdk' => 'No Data Found',
'whois.nic.teva' => 'No Data Found',
view all matches for this distribution
view release on metacpan or search on metacpan
t/data/cell.obo view on Meta::CPAN
name: stratum granulosum cell
is_a: CL:0000362 ! epidermal cell
[Term]
id: CL:0000713
name: corona radiata cell
is_a: CL:0000711 ! cumulus cell
[Term]
id: CL:0000715
name: embryonic crystal cell
view all matches for this distribution
view release on metacpan or search on metacpan
docs/introduction.mkdn view on Meta::CPAN
to the client, and `receive`, an asynchronous coderef which lets the application
receive event messages from the client. Both coderefs return `Future` objects to
make back-pressure explicit.
This not only allows multiple incoming events and outgoing events for each
application, but also allows for a background process or coroutine so the application
can do other things (such as listening for events on an external trigger, like a
Redis queue).
In its simplest form, an application can be written as an **asynchronous
function in modern Perl**, like this:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/PDL/IO/Dcm/Plugins/MRISiemens.pm view on Meta::CPAN
} else {
$self->hdr->{ro}='y';
$self->hdr->{pe}='x';
}
}
if ($self->hdr->{orientation} eq 'Cor'){ # coronal slice
$self->hdr->{sl}='y';
if ($pe eq 'COL') {
$self->hdr->{ro}='x';
$self->hdr->{pe}='z';
} else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/PEF/Front/WebSocket.pm view on Meta::CPAN
</body>
</html>
# wstest.ini
[uwsgi]
plugins = coroae
chdir = /$PROJECT_DIR
logger = file:log/demo.log
psgi = bin/startup.pl
master = true
processes = 4
coroae = 1000
perl-no-plack = true
psgi-enable-psgix-io = true
uid = $PROJECT_USER
gid = www-data
chmod-socket = 664
view all matches for this distribution
view release on metacpan or search on metacpan
lib/PEF/Front/Oauth.pm view on Meta::CPAN
use HTTP::Request::Common;
use JSON;
use PEF::Front::Config;
use PEF::Front::Session;
my $coro_ae_lwp;
BEGIN {
if ($INC{'Coro/AnyEvent.pm'}) {
eval "use AnyEvent::HTTP::LWP::UserAgent";
$coro_ae_lwp = ($@) ? 0 : 1;
} else {
$coro_ae_lwp = 0;
}
}
sub _authorization_server {
die 'unimplemented base method';
lib/PEF/Front/Oauth.pm view on Meta::CPAN
if ($request->{code}) {
my $token_answer;
delete $self->{session}->data->{oauth_state};
$self->{session}->store;
my $exception;
if ($coro_ae_lwp && $Coro::main != $Coro::current) {
my $lwp_user_agent = AnyEvent::HTTP::LWP::UserAgent->new;
$lwp_user_agent->timeout(cfg_oauth_connect_timeout());
my $request = $self->_token_request($request->{code});
my $response = $lwp_user_agent->request($request);
$exception = "timeout" if !$response or !$response->decoded_content;
lib/PEF/Front/Oauth.pm view on Meta::CPAN
sub get_user_info {
my ($self) = @_;
my $info;
$self->{session}->store;
my $exception;
if ($coro_ae_lwp && $Coro::main != $Coro::current) {
my $lwp_user_agent = AnyEvent::HTTP::LWP::UserAgent->new;
$lwp_user_agent->timeout(cfg_oauth_connect_timeout());
my $response = $lwp_user_agent->request($self->_get_user_info_request);
if ($response && $response->decoded_content) {
$info = eval {decode_json $response->decoded_content};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POD2/RU/perlguts.pod view on Meta::CPAN
=head2 Putting a C value on Perl stack
A lot of opcodes (this is an elementary operation in the internal perl
stack machine) put an SV* on the stack. However, as an optimization
the corresponding SV is (usually) not recreated each time. The opcodes
reuse specially assigned SVs (I<target>s) which are (as a corollary)
not constantly freed/created.
Each of the targets is created only once (but see
L<Scratchpads and recursion> below), and when an opcode needs to put
an integer, a double, or a string on stack, it just sets the
lib/POD2/RU/perlguts.pod view on Meta::CPAN
example above it looks like:
$b ---> $c ---> + ---> $a ---> assign-to
But with the actual compile tree for C<$a = $b + $c> it is different:
some nodes I<optimized away>. As a corollary, though the actual tree
contains more nodes than our simplified example, the execution order
is the same as in our example.
=head2 Examining the tree
view all matches for this distribution
view release on metacpan or search on metacpan
- Console.pm: Dump hashes and arrays recursively
- Enable all debugging messages if $ENV{POCOIRC_DEBUG} is true
- Make the 'shutdown' event do more work for us, such as forcibly
disconnecting after a timeout if the server doesn't disconnect us
following a QUIT command
- Add an irc_raw_out event, corollary to irc_raw
- AutoJoin.pm: Don't require the component to be ::State
6.49 Sat Oct 16 19:05:25 GMT 2010
- Add draft-mitchell-irc-capabilities-02.html to docs/
- Fix incorrect number of skipped tests in 06_online.t in some cases
view all matches for this distribution
view release on metacpan or search on metacpan
(?&PerlBlock) $PPR::GRAMMAR
}x;
# Define a regex that will match a simple Perl extension...
my $perl_coroutine = qr{
# What to match...
coro (?&PerlOWS)
(?<coro_name> (?&PerlQualifiedIdentifier) ) (?&PerlOWS)
(?<coro_code> (?&PerlBlock) )
# Install the necessary subrules...
$PPR::GRAMMAR
}x;
view all matches for this distribution
view release on metacpan or search on metacpan
PostalCode.pm view on Meta::CPAN
'2350' => [
[ '051', '059', 'BROGUEIRA' ] ] },
'Atouguia' => {
'2350' => [
[ '471', '508', 'TORRES NOVAS' ] ] },
'Alcorochel' => {
'2350' => [
[ '001', '001', 'ALCOROCHEL' ] ] },
'Almonda' => {
'2350' => [
[ '817', '817', 'ZIBREIRA' ] ] },
PostalCode.pm view on Meta::CPAN
'2354' => [
[ '001', '001', 'ZIBREIRA' ] ] },
'Meziões' => {
'2350' => [
[ '405', '405', 'TORRES NOVAS' ] ] },
'Charneca de Alcorochel' => {
'2350' => [
[ '003', '003', 'ALCOROCHEL' ] ] },
'Além da Ribeira' => {
'2350' => [
[ '010', '014', 'ASSENTIZ TNV' ] ] },
view all matches for this distribution
view release on metacpan or search on metacpan
t/data/03modlist.data view on Meta::CPAN
'R',
'd',
'c',
'h',
'p',
'create an manage coroutines',
'MLEHMANN',
'20'
],
[
'PApp::SQL',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ParseUtil/Domain/ConfigData.pm view on Meta::CPAN
Return the compiled regex.
=cut
sub tld_regex {
return qr{
(?^u:(?:j(?:p(?:\.(?:h(?:okkaido(?:\.(?:k(?:a(?:m(?:i(?:s(?:unagawa|hihoro)|furano|kawa)|oenai)|yabe)|i(?:ta(?:hiroshima|mi)|mobetsu|yosato|konai)|u(?:r(?:omatsunai|iyama)|nneppu|shiro|tchan)|oshimizu|embuchi|yowa)|s(?:h(?:i(?:r(?:a(?:nuka|oi)|iu...
}x;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
ca-bundle.crt view on Meta::CPAN
fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
g14=
-----END CERTIFICATE-----
Taiwan GRCA
===========
view all matches for this distribution
view release on metacpan or search on metacpan
v0.5.8 2018-11-11T14:12:33Z
- code cleanup
v0.5.7 2018-10-17T03:26:30Z
- coro loop fixed
v0.5.6 2018-09-18T17:58:32Z
- typo
v0.5.5 2018-09-09T18:59:06Z
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Pcore/Core/Exception.pm view on Meta::CPAN
local $@;
eval { $e->sendlog('FATAL') };
}
# cancel current coro execution. but not exit the script
$Coro::current->cancel;
}
else {
CORE::die $e; # set $@ to $e
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perl/LanguageServer.pm view on Meta::CPAN
our $json = JSON -> new -> utf8(1) -> ascii(1) ;
our $jsonpretty = JSON -> new -> utf8(1) -> ascii(1) -> pretty (1) ;
our %running_reqs ;
our %running_coros ;
our $exit ;
our $workspace ;
our $dev_tool ;
our $debug1 = 0 ;
our $debug2 = 0 ;
lib/Perl/LanguageServer.pm view on Meta::CPAN
{
my ($self, $id, $reqdata) = @_ ;
my $xid = $id ;
$xid ||= $reqseq++ ;
$running_coros{$xid} = async
{
my $req_guard = Guard::guard
{
$self -> logger ("done handle_req id=$xid\n") if ($debug1) ;
delete $running_reqs{$xid} ;
delete $running_coros{$xid} ;
};
my $type = $reqdata -> {type} ;
my $is_dap = $type?1:0 ;
$type = defined ($id)?'request':'notification' if (!$type) ;
lib/Perl/LanguageServer.pm view on Meta::CPAN
my $i = 0 ;
while (1)
{
if ($heartbeat || $debug2)
{
logger (undef, "##### $i #####\n running: " . dump (\%running_reqs) . " coros: " . dump (\%running_coros), "\n") ;
$i++ ;
}
Coro::AnyEvent::sleep (10) ;
}
lib/Perl/LanguageServer.pm view on Meta::CPAN
=over
=item * Run, pause, step, next, return
=item * Support for coro threads
=item * Breakpoints
=item * Conditional breakpoints
=item * Breakpoints can be set while program runs and for modules not yet loaded
=item * Variable view, can switch to every stack frame or coro thread
=item * Set variable
=item * Watch variable
=item * Tooltips with variable values
=item * Evaluate perl code in debuggee, in context of every stack frame of coro thread
=item * Automatically reload changed Perl modules while debugging
=item * Debug multiple perl programs at once
lib/Perl/LanguageServer.pm view on Meta::CPAN
sudo apt install libanyevent-perl libclass-refresh-perl libcompiler-lexer-perl \
libdata-dump-perl libio-aio-perl libjson-perl libmoose-perl libpadwalker-perl \
libscalar-list-utils-perl libcoro-perl
sudo cpan Perl::LanguageServer
e.g. on Centos 7 run:
lib/Perl/LanguageServer.pm view on Meta::CPAN
=item * Default debug configuration is now automatically provided without
the need to create a C<launch.json> first (#103)
=item * Add Option C<cacheDir> to specify location of cache dir (#113)
=item * Fix: Debugger outputted invalid thread reference causes "no such coroutine" message,
so watchs and code from the debug console is not expanded properly
=item * Fix: LanguageServer hangs when multiple request send at once from VSCode to LanguageServer
=item * Fix: cwd parameter for debugger in launch.json had no effect (#99)
view all matches for this distribution
view release on metacpan or search on metacpan
t/scan/heredoc.t view on Meta::CPAN
acontecer
acoplar
acopular
acoquinar
acordar
acoronhar
acorrentar
acorrer
acossar
acostar
acostumar
view all matches for this distribution
view release on metacpan or search on metacpan
t/snippets20.t view on Meta::CPAN
'git25' => <<'----------',
# example for git #25; use -l=0; was losing alignment; sub 'fix_ragged_lists' was added to fix this
my $mapping = [
# ...
{ 'is_col' => 'dsstdat', 'cr_col' => 'enroll_isaric_date', 'trans' => 0, },
{ 'is_col' => 'corona_ieorres', 'cr_col' => '', 'trans' => 0, },
{ 'is_col' => 'symptoms_fever', 'cr_col' => 'elig_fever', 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
{ 'is_col' => 'symptoms_cough', 'cr_col' => 'elig_cough', 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
{ 'is_col' => 'symptoms_dys_tachy_noea', 'cr_col' => 'elig_dyspnea', 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
{ 'is_col' => 'symptoms_clinical_susp', 'cr_col' => 'elig_ari', 'trans' => 0, },
{ 'is_col' => 'sex', 'cr_col' => 'sex', 'trans' => 1, 'manually_reviewed' => 1, 'map' => { '0' => '1', '1' => '2' }, },
t/snippets20.t view on Meta::CPAN
# example for git #25; use -l=0; was losing alignment; sub 'fix_ragged_lists' was added to fix this
my $mapping = [
# ...
{ 'is_col' => 'dsstdat', 'cr_col' => 'enroll_isaric_date', 'trans' => 0, },
{ 'is_col' => 'corona_ieorres', 'cr_col' => '', 'trans' => 0, },
{
'is_col' => 'symptoms_fever',
'cr_col' => 'elig_fever',
'trans' => 1,
'manually_reviewed' => '@TODO',
t/snippets20.t view on Meta::CPAN
# example for git #25; use -l=0; was losing alignment; sub 'fix_ragged_lists' was added to fix this
my $mapping = [
# ...
{ 'is_col' => 'dsstdat', 'cr_col' => 'enroll_isaric_date', 'trans' => 0, },
{ 'is_col' => 'corona_ieorres', 'cr_col' => '', 'trans' => 0, },
{ 'is_col' => 'symptoms_fever', 'cr_col' => 'elig_fever', 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
{ 'is_col' => 'symptoms_cough', 'cr_col' => 'elig_cough', 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
{ 'is_col' => 'symptoms_dys_tachy_noea', 'cr_col' => 'elig_dyspnea', 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
{ 'is_col' => 'symptoms_clinical_susp', 'cr_col' => 'elig_ari', 'trans' => 0, },
{ 'is_col' => 'sex', 'cr_col' => 'sex', 'trans' => 1, 'manually_reviewed' => 1, 'map' => { '0' => '1', '1' => '2' }, },
view all matches for this distribution
view release on metacpan or search on metacpan
share/Apocalypse/A12.pod view on Meta::CPAN
=head2 The gather/take Construct
We used one example of the conjectural gather/take construct. A gather
executes a closure, returning a list of all the values returned by
C<take> within its lexical scope. In a lazy context it might run as
a coroutine. There probably ought to be a dynamically scoped variant.
Unless it should be dynamic by default, in which case there probably
ought to be a lexically scoped variant...
=head2 :foo() Adverbs
share/Apocalypse/A12.pod view on Meta::CPAN
same for most Unicode fonts that restrict themselves to single and
double-wide characters.
=head2 String positions
A corollary to the preceding is that string positions are not numbers.
If you say either
$pos = index($string, "foo");
or
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perl6/GatherTake.pm view on Meta::CPAN
use Coro::Channel;
use Carp qw(confess);
use Scalar::Util qw(refaddr);
our @EXPORT = qw(gather take);
our %_coro_to_queue;
sub gather(&@) {
my $code = shift;
# cheat prototype by prepending '&' to method call:
my $coro = &async($code, @_);
my @result = ();
my $queue = Coro::Channel->new(1);
# print "Initialized coro $coro\n";
$_coro_to_queue{refaddr($coro)} = $queue;
tie @result, 'Perl6::GatherTake::LazyList', $coro, $queue;
return \@result;
}
sub take {
my $c = Coro::current;
# print "Take: $c\n";
for (@_){
$_coro_to_queue{refaddr($c)}->put($_);
}
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
docs/talks/perl6-apw2005/code/class/coro1.pl view on Meta::CPAN
#=Coroutinen
use v6;
coro zähler {
for 1..10 -> $i {
yield $i;
}
}
view all matches for this distribution