|
Coro::Cont - schmorp's faked continuations |
Coro::Cont - schmorp's faked continuations
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;
Marc Lehmann <pcg@goof.com> http://www.goof.com/pcg/marc/
|
Coro::Cont - schmorp's faked continuations |