Coro::Cont - schmorp's faked continuations


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/

 Coro::Cont - schmorp's faked continuations