Marc A. Lehmann
/
Coro-0.52
/
Coro::Cont
NAME
Coro::Cont - schmorp's faked continuations
SYNOPSIS
use Coro::Cont;
# multiply all hash keys by 2
my $cont = csub {
yield $_*2;
yield $_;
};
my %hash2 = map &$csub, &hash1;
# dasselbe in grün (as we germans say)
sub mul2 : Cont {
yield $_[0]*2;
yield $_[0];
}
my %hash2 = map mul2($_), &hash1;
DESCRIPTION
- csub { ... }
-
Create a new "continuation" (when the sub falls of the end it is being terminated).
- @_ = yield [list]
-
Return the given list/scalar as result of the continuation. Also returns the new arguments given to the subroutine on the next call.
AUTHOR
Marc Lehmann <pcg@goof.com>
http://www.goof.com/pcg/marc/
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 16:
Non-ASCII character seen before =encoding in 'grün'. Assuming UTF-8